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()); ...