The new ProcessHandle interface

There are two new interfaces and also their implementations in Java 9 supporting the handling of operating system processes. One of them is ProcessHandle, the other one is ProcessHandle.Info, a nested interface of the prior.

A ProcessHandle object identifies an operating system process and provides methods to manage the process. In prior versions of Java, this was possible only using operating system specific methods using the PID to identify the process. The major problem with this approach is 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 know only the PID of a process and check to see if the process ...

Get Java 9: Building Robust Modular Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.