Managing Processes in Java

With a very quick tour through some of the big new features of Java 9, as well as those from a couple of previous releases, let's turn our attention to applying some of these new APIs in a practical manner. We'll start with a simple process manager.

While having your application or utility handle all of your user's concerns internally is usually ideal, occasionally you need to run (or shell out to) an external program for a variety of reasons. From the very first days of Java, this was supported by the JDK via the Runtime class via a variety of APIs. Here is the simplest example:

    Process p = Runtime.getRuntime().exec("/path/to/program"); 

Once the process has been created, you can track its execution via the

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.