Taking control of external processes

Up to JDK 9, if you wanted to create a Java process and handle process input/output, you had to use either the Runtime.getRuntime.exec() method, which allows us to execute a command in a separate OS process and get a java.lang.Process instance over which to provide certain operations in order to manage the external process, or use the new java.lang.ProcessBuilder class with some more enhancements in regard to interacting with the external process and also create a java.lang.Process instance to represent the external process. Both mechanisms were inflexible and also non-portable as the set of commands executed by the external processes were highly dependent on the operating system (additional effort had ...

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.