Introduction
The java.lang.Process
class is used to look for information about, and launch, runtime processes. If you want to understand how the Process
class works, you can start by looking at the Runtime
class. All Java programs include an instance of the Runtime
class. It is possible to get information about the Runtime
class by calling the getRuntime()
method and assigning its outcome to a variable of the Runtime
class. With that, it is possible to obtain information about the JVM environment that commands your program:
public class Example01 { Â Â Â Â public static void main(String[] args) { Â Â Â Â Â Â Â Â Runtime runtime = Runtime.getRuntime(); Â Â Â Â Â Â Â Â System.out.println("Processors: " + runtime.availableProcessors()); Â Â Â Â Â Â Â Â System.out.println("Total memory: " + runtime.totalMemory()); Â Â Â Â Â Â Â ...