Home >Java >javaTutorial >What new methods are added to the Process API in Java 9?
Java 9 improves the Process class by adding new methods and also provides new interfaces: ProcessHandle and ProcessHandle .Info to get all the details about the process and its information.
The following is a list of new methods added to Process in Java 9
public class ProcessTest { public static void main(String args[]) { <strong> ProcessHandle </strong>processHandle = ProcessHandle.current(); <strong> ProcessHandle.Info</strong> processInfo = processHandle.info(); System.out.println(processHandle.<strong>pid()</strong>); System.out.println(processHandle.<strong>parent()</strong>); System.out.println(processInfo.<strong>arguments()</strong>.<strong>isPresent()</strong>); System.out.println(processInfo.<strong>command()</strong>.<strong>isPresent()</strong>); System.out.println(processInfo.<strong>command().get().contains</strong>("tutorialspoint")); System.out.println(processInfo.<strong>startInstant().isPresent()</strong>); } }
<strong>4892 Optional[7788] false true false true</strong>
The above is the detailed content of What new methods are added to the Process API in Java 9?. For more information, please follow other related articles on the PHP Chinese website!