GeezerVison is showing docs.oracle.com — ProcessBuilder (Java Platform SE 8 )
Java™ Platform Standard Ed. 8
compact1, compact2, compact3
java.lang
Class ProcessBuilder
-
-
Nested Class Summary
Nested Classes
| Modifier and Type |
Class |
Description |
static class |
ProcessBuilder.Redirect |
Represents a source of subprocess input or a destination of
subprocess output.
|
-
Constructor Summary
Constructors
| Constructor |
Description |
ProcessBuilder(List<String> command) |
Constructs a process builder with the specified operating
system program and arguments.
|
ProcessBuilder(String... command) |
Constructs a process builder with the specified operating
system program and arguments.
|
-
Method Summary
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
ProcessBuilder
public ProcessBuilder(List<String> command)
Constructs a process builder with the specified operating
system program and arguments. This constructor does not
make a copy of the command list. Subsequent
updates to the list will be reflected in the state of the
process builder. It is not checked whether
command corresponds to a valid operating system
command.
- Parameters:
command - the list containing the program and its arguments
- Throws:
NullPointerException - if the argument is null
-
ProcessBuilder
public ProcessBuilder(String... command)
Constructs a process builder with the specified operating
system program and arguments. This is a convenience
constructor that sets the process builder's command to a string
list containing the same strings as the command
array, in the same order. It is not checked whether
command corresponds to a valid operating system
command.
- Parameters:
command - a string array containing the program and its arguments
-
Method Detail
-
command
public ProcessBuilder command(List<String> command)
Sets this process builder's operating system program and
arguments. This method does not make a copy of the
command list. Subsequent updates to the list will
be reflected in the state of the process builder. It is not
checked whether command corresponds to a valid
operating system command.
- Parameters:
command - the list containing the program and its arguments
- Returns:
- this process builder
- Throws:
NullPointerException - if the argument is null
-
command
public ProcessBuilder command(String... command)
Sets this process builder's operating system program and
arguments. This is a convenience method that sets the command
to a string list containing the same strings as the
command array, in the same order. It is not
checked whether command corresponds to a valid
operating system command.
- Parameters:
command - a string array containing the program and its arguments
- Returns:
- this process builder
-
command
public List<String> command()
Returns this process builder's operating system program and
arguments. The returned list is not a copy. Subsequent
updates to the list will be reflected in the state of this
process builder.
- Returns:
- this process builder's program and its arguments
-
directory
public File directory()
Returns this process builder's working directory.
Subprocesses subsequently started by this object's start() method will use this as their working directory.
The returned value may be null -- this means to use
the working directory of the current Java process, usually the
directory named by the system property user.dir,
as the working directory of the child process.
- Returns:
- this process builder's working directory
Java™ Platform Standard Ed. 8
Submit a bug or feature For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. Copyright © 1993, 2026, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
|