-
Notifications
You must be signed in to change notification settings - Fork 0
Standalone Process
Michael Wieland edited this page Mar 12, 2018
·
3 revisions
- Java9 Feature
- Each JVM takes up one process.
- You can start other processes with other JVM instances; these exist completely separate in memory, and generally are unrelated from each other.
- Process and Processhandle
- Socket
- Write Files
- RMI
- Streams (using ProcessBuilder)
String[] startOptions = new String[] {"java", "-jar", "adv-root-1.0.jar"};
Process ps = Runtime.getRuntime().exec(startOptions);
ps.isAlive();
// ps.waitFor();
String[] startOptions = new String[] {"java", "-jar", "adv-root-1.0.jar"};
Process ps= new ProcessBuilder().command(startOptions).start();
ps.isAlive();
// ps.waitFor();
ProcessHandle handle = ProcessHandle.current();
handle.pid();
handle.children().count();