ProcessBuilder Class

The ProcessBuilder class lets you create and start operating system processes.

See Creating a Process for examples on how to create and start a process. The ProcessBuilder class manages various process attributes, which the following table summarizes:

Table 6-1 ProcessBuilder Class Attributes and Related Methods

Process Attribute Description Related Methods
Command Strings that specify the external program file to call and its arguments, if any.
Environment The environment variables (and their values). This is initially a copy of the system environment of the current process (see the System.getEnv() method).
Working directory By default, the current working directory of the current process.
Standard input source By default, a process reads standard input from a pipe; access this through the output stream returned by the Process.getOutputStream method.
Standard output and standard error destinations By default, a process writes standard output and standard error to pipes; access these through the input streams returned by the Process.getInputStream and Process.getErrorStream methods. See Redirecting Output from a Process for an example.
redirectErrorStream property Specifies whether to send standard output and error output as two separate streams (with a value of false) or merge any error output with standard output (with a value of true).