Package jnr.process
Class ProcessBuilder
- java.lang.Object
-
- jnr.process.ProcessBuilder
-
public class ProcessBuilder extends java.lang.ObjectProcessBuilder mimics the API of the JDKProcessBuilderclass, providing methods to build up and launch a child process.
-
-
Constructor Summary
Constructors Constructor Description ProcessBuilder(java.lang.String... command)Create a new ProcessBuilder instance with the given command line.ProcessBuilder(java.util.List<java.lang.String> command)Create a new ProcessBuilder instance with the given command line.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<java.lang.String>command()Get a copy of the list of command line arguments that will be used to launch the child process.ProcessBuildercommand(java.lang.String... command)Replace the command line with the given varargs array of command line arguments.ProcessBuildercommand(java.util.List<java.lang.String> command)Replace the command line with the given list of command line arguments.java.util.Map<java.lang.String,java.lang.String>environment()Returns a string map view of this process builder's environment.Processstart()Launch the subprocess and return a newProcessinstance.
-
-
-
Constructor Detail
-
ProcessBuilder
public ProcessBuilder(java.util.List<java.lang.String> command)
Create a new ProcessBuilder instance with the given command line.- Parameters:
command- the command line as a list of string arguments
-
ProcessBuilder
public ProcessBuilder(java.lang.String... command)
Create a new ProcessBuilder instance with the given command line.- Parameters:
command- the command line as a varargs array of string arguments
-
-
Method Detail
-
command
public java.util.List<java.lang.String> command()
Get a copy of the list of command line arguments that will be used to launch the child process.- Returns:
- a copied list of command line arguments
-
command
public ProcessBuilder command(java.util.List<java.lang.String> command)
Replace the command line with the given list of command line arguments.- Parameters:
command- the new list of command line arguments- Returns:
- this ProcessBuilder instance
-
command
public ProcessBuilder command(java.lang.String... command)
Replace the command line with the given varargs array of command line arguments.- Parameters:
command- the new array of command line arguments- Returns:
- this ProcessBuilder instance
-
environment
public java.util.Map<java.lang.String,java.lang.String> environment()
Returns a string map view of this process builder's environment. Whenever a process builder is created, the environment is initialized to a copy of the current process environment (SeeSystem.getenv()). Subprocesses subsequently started by this object'sstart()method will use this map as their environment.The returned object may be modified using ordinary
Mapoperators.- Returns:
- The process builder's environment.
-
-