|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.ProcessBuilder
public final class ProcessBuilder
A builder for creating OS-specific processes.
| Constructor Summary | |
|---|---|
ProcessBuilder(List<String> command)
Constructs an instance with the given command. |
|
ProcessBuilder(String... command)
Constructs an instance with the given command. |
|
| Method Summary | |
|---|---|
List<String> |
command()
The builder's current program and arguments. |
ProcessBuilder |
command(List<String> command)
Changes the program and arguments to the command given. |
ProcessBuilder |
command(String... command)
Changes the program and arguments to the command given. |
File |
directory()
The working directory that's currently set. |
ProcessBuilder |
directory(File directory)
Changes the working directory to the directory given. |
Map<String,String> |
environment()
The builder's current environment. |
boolean |
redirectErrorStream()
Indicates whether or not the standard error should be redirected to standard output. |
ProcessBuilder |
redirectErrorStream(boolean redirectErrorStream)
Changes the state of whether or not standard error is redirected. |
Process |
start()
Starts a new process based on the current state of the builder. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ProcessBuilder(String... command)
Constructs an instance with the given command.
command - The program and arguments.public ProcessBuilder(List<String> command)
Constructs an instance with the given command.
command - The program and arguments.
NullPointerException - if command is null.| Method Detail |
|---|
public List<String> command()
The builder's current program and arguments. The returned value is considered live and modifications to it will change the state of the instance.
public ProcessBuilder command(String... command)
Changes the program and arguments to the command given.
command - The program and arguments.
public ProcessBuilder command(List<String> command)
Changes the program and arguments to the command given. The list passed is not copied, so any subsequent updates to it are reflected in this instance's state.
command - The program and arguments.
NullPointerException - if command is null.public File directory()
The working directory that's currently set. If this value is
null, then the working directory of the Java process is
used.
null.public ProcessBuilder directory(File directory)
Changes the working directory to the directory given. If the given
directory is null, then the working directory of the Java
process is used when a process is started.
directory - The working directory to set.
public Map<String,String> environment()
The builder's current environment. When an instance is created, the
environment is populated with a copy of the environment, as returned by
System.getenv(). The Map returned is live and any changes made
to it are reflected in this instance's state.
public boolean redirectErrorStream()
Indicates whether or not the standard error should be redirected to
standard output. If redirected, the Process.getErrorStream() will
always return end of stream and standard error is written to
Process.getInputStream().
public ProcessBuilder redirectErrorStream(boolean redirectErrorStream)
Changes the state of whether or not standard error is redirected.
redirectErrorStream - true to redirect standard error,
false if not.
public Process start()
throws IOException
Starts a new process based on the current state of the builder.
NullPointerException - if any of the elements of command() are
null.
IndexOutOfBoundsException - if command() is empty.
SecurityException - if SecurityManager.checkExec(String) doesn't allow
process creation.
IOException - if an I/O error happens.
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||