Two new interfaces were introduced in Java 9 that support handling operating system processes—ProcessHandle and ProcessHandle.Info.
A ProcessHandle object identifies an operating system process and provides methods to manage the process. In prior versions of Java, this was only possible with operating system-specific methods using the PID to identify the process. The major problem with this approach was that the PID is unique only while the process is active. When a process finishes, the operating system is free to reuse the PID for a new process. When we check to see if a process is still running, using the PID, we are really checking for an active process with that PID. Our process may be alive when we check it, but the next time our program queries the process state, it might be a different process.
The desktop and server operating...