ProcessBuilder class

This class is used to create operating system processes.

Create ProcessBuilder

ProcessBuilder(List<String> command)
Creates a process builder with the specified operating system program and arguments.
ProcessBuilder(String... command)
Creates a process builder with the specified operating system program and arguments.
List<String> command()
Returns this process builder's operating system program and arguments.
ProcessBuilder command(List<String> command)
Sets this process builder's operating system program and arguments.
ProcessBuilder command(String... command)
Sets this process builder's operating system program and arguments.
File directory()
Returns this process builder's working directory.
ProcessBuilder directory(File directory)
Sets this process builder's working directory.
Map<String,String> environment()
Returns a string map view of this process builder's environment.
boolean redirectErrorStream()
Tells whether this process builder merges standard error and standard output.
ProcessBuilder redirectErrorStream(boolean redirectErrorStream)
Sets this process builder's redirectErrorStream property.
Process start()
Starts a new process using the attributes of this process builder.

Revised from Open JDK source code

Home 
  Java Book 
    Essential Classes  

ProcessBuilder:
  1. ProcessBuilder class
  2. Create ProcessBuilder
  3. Get/set the working directory
  4. Get the environment variables
  5. Start a new process