Java Code Examples for java.lang.management.RuntimeMXBean#getClassPath()
The following examples show how to use
java.lang.management.RuntimeMXBean#getClassPath() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LocatorStatusResponse.java From gemfirexd-oss with Apache License 2.0 | 6 votes |
public LocatorStatusResponse initialize(final int locatorPort, final String locatorHost, final String locatorLogFile, final String locatorName) { final RuntimeMXBean runtimeBean = ManagementFactory.getRuntimeMXBean(); this.pid = identifyPid(); this.jvmArgs = runtimeBean.getInputArguments(); this.uptime = runtimeBean.getUptime(); this.classpath = runtimeBean.getClassPath(); this.gemfireVersion = GemFireVersion.getGemFireVersion(); this.javaVersion = System.getProperty("java.version"); this.workingDirectory = System.getProperty("user.dir"); this.logFile = locatorLogFile; this.host = locatorHost; this.port = locatorPort; this.name = locatorName; return this; }
Example 2
Source File: LocatorStatusResponse.java From gemfirexd-oss with Apache License 2.0 | 6 votes |
public LocatorStatusResponse initialize(final int locatorPort, final String locatorHost, final String locatorLogFile, final String locatorName) { final RuntimeMXBean runtimeBean = ManagementFactory.getRuntimeMXBean(); this.pid = identifyPid(); this.jvmArgs = runtimeBean.getInputArguments(); this.uptime = runtimeBean.getUptime(); this.classpath = runtimeBean.getClassPath(); this.gemfireVersion = GemFireVersion.getGemFireVersion(); this.javaVersion = System.getProperty("java.version"); this.workingDirectory = System.getProperty("user.dir"); this.logFile = locatorLogFile; this.host = locatorHost; this.port = locatorPort; this.name = locatorName; return this; }
Example 3
Source File: MyTestUtils.java From semanticvectors with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Spawn a child to execute the main method in Class childMain * using the same args and environment as the current runtime. * This method prevents a child processes from hanging * when its output buffers saturate by creating threads to * empty the output buffers. * @return The process, already started. Consider using waitForAndDestroy() to clean up afterwards. * @param childMain The Class to spawn, must contain main function * @param inputArgs arguments for the main class. Use null to pass no arguments. * @param in The child process will read input from this stream. Use null to avoid reading input. Always close() your stream when you are done or you may deadlock. * @param out The child process will write output to this stream. Use null to avoid writing output. * @param err The child process will write errors to this stream. Use null to avoid writing output. */ public static Process spawnChildProcess( Class<?> childMain, String[] inputArgs, InputStream in, OutputStream out, OutputStream err) throws IOException { //get the same arguments as used to start this JRE RuntimeMXBean rmxb = ManagementFactory.getRuntimeMXBean(); List<String> arglist = rmxb.getInputArguments(); String cp = rmxb.getClassPath(); //construct "java <arguments> <main-class-name>" ArrayList<String> arguments = new ArrayList<String>(arglist); arguments.add(0, "java"); arguments.add("-classpath"); arguments.add(cp); arguments.add(childMain.getCanonicalName()); for (String arg : inputArgs) arguments.add(arg); //using ProcessBuilder initializes the child process with parent's env. ProcessBuilder pb = new ProcessBuilder(arguments); //redirecting STDERR to STDOUT needs to be done before starting if (err == out) { pb.redirectErrorStream(true); } Process proc; proc = pb.start(); //Might throw an IOException to calling method //setup stdin if (in != null) { new OutputReader(in, proc.getOutputStream()).start(); } //setup stdout if (out == null) { out = new NullOutputStream(); } new OutputReader(proc.getInputStream(), out).start(); //setup stderr if (!pb.redirectErrorStream()) { if (err == null) { err = new NullOutputStream(); } new OutputReader(proc.getErrorStream(), err).start(); } return proc; }
Example 4
Source File: CommonTestUtils.java From Flink-CEPplus with Apache License 2.0 | 2 votes |
/** * Gets the classpath with which the current JVM was started. * * @return The classpath with which the current JVM was started. */ public static String getCurrentClasspath() { RuntimeMXBean bean = ManagementFactory.getRuntimeMXBean(); return bean.getClassPath(); }
Example 5
Source File: CommonTestUtils.java From flink with Apache License 2.0 | 2 votes |
/** * Gets the classpath with which the current JVM was started. * * @return The classpath with which the current JVM was started. */ public static String getCurrentClasspath() { RuntimeMXBean bean = ManagementFactory.getRuntimeMXBean(); return bean.getClassPath(); }
Example 6
Source File: CommonTestUtils.java From flink with Apache License 2.0 | 2 votes |
/** * Gets the classpath with which the current JVM was started. * * @return The classpath with which the current JVM was started. */ public static String getCurrentClasspath() { RuntimeMXBean bean = ManagementFactory.getRuntimeMXBean(); return bean.getClassPath(); }