java.lang.ProcessBuilder クラス
Java 2 SE 5.0のJavaDocを何気なく眺めていてふと気になった。「確かこんなクラスはなかったよなぁ‥」と。確認してみたら、確かに「Since: 1.5」と書いてある。
要するに、Runtimeクラスのexec()メソッドをより扱いやすくしたものということだろう。
This class is used to create operating system processes.
Each ProcessBuilder instance manages a collection of process attributes. The start() method creates a new Process instance with those attributes. The start() method can be invoked repeatedly from the same instance to create new subprocesses with identical or related attributes.
Runtimeクラスのexec()メソッドのJavaDocにはこんなことが書いてある。
ProcessBuilder.start() is now the preferred way to start a process with a modified environment.