public class ProcessBuilder extends Object
ProcessBuilder class, providing methods to build up and
launch a child process.| Constructor and Description |
|---|
ProcessBuilder(List<String> command)
Create a new ProcessBuilder instance with the given command line.
|
ProcessBuilder(String... command)
Create a new ProcessBuilder instance with the given command line.
|
| Modifier and Type | Method and Description |
|---|---|
List<String> |
command()
Get a copy of the list of command line arguments that will be used to launch the child process.
|
ProcessBuilder |
command(List<String> command)
Replace the command line with the given list of command line arguments.
|
ProcessBuilder |
command(String... command)
Replace the command line with the given varargs array of command line arguments.
|
Map<String,String> |
environment()
Returns a string map view of this process builder's environment.
|
Process |
start()
Launch the subprocess and return a new
Process instance. |
public ProcessBuilder(List<String> command)
command - the command line as a list of string argumentspublic ProcessBuilder(String... command)
command - the command line as a varargs array of string argumentspublic List<String> command()
public ProcessBuilder command(List<String> command)
command - the new list of command line argumentspublic ProcessBuilder command(String... command)
command - the new array of command line argumentspublic Map<String,String> environment()
System.getenv()). Subprocesses subsequently
started by this object's start() method will use this map as their environment.
The returned object may be modified using ordinary Map operators.
Copyright © 2020. All rights reserved.