src/share/classes/java/lang/ProcessBuilder.java

Print this page




 921      * @return this process builder
 922      */
 923     public ProcessBuilder redirectErrorStream(boolean redirectErrorStream) {
 924         this.redirectErrorStream = redirectErrorStream;
 925         return this;
 926     }
 927 
 928     /**
 929      * Starts a new process using the attributes of this process builder.
 930      *
 931      * <p>The new process will
 932      * invoke the command and arguments given by {@link #command()},
 933      * in a working directory as given by {@link #directory()},
 934      * with a process environment as given by {@link #environment()}.
 935      *
 936      * <p>This method checks that the command is a valid operating
 937      * system command.  Which commands are valid is system-dependent,
 938      * but at the very least the command must be a non-empty list of
 939      * non-null strings.
 940      *





 941      * <p>If there is a security manager, its
 942      * {@link SecurityManager#checkExec checkExec}
 943      * method is called with the first component of this object's
 944      * {@code command} array as its argument. This may result in
 945      * a {@link SecurityException} being thrown.
 946      *
 947      * <p>Starting an operating system process is highly system-dependent.
 948      * Among the many things that can go wrong are:
 949      * <ul>
 950      * <li>The operating system program file was not found.
 951      * <li>Access to the program file was denied.
 952      * <li>The working directory does not exist.
 953      * </ul>
 954      *
 955      * <p>In such cases an exception will be thrown.  The exact nature
 956      * of the exception is system-dependent, but it will always be a
 957      * subclass of {@link IOException}.
 958      *
 959      * <p>Subsequent modifications to this process builder will not
 960      * affect the returned {@link Process}.




 921      * @return this process builder
 922      */
 923     public ProcessBuilder redirectErrorStream(boolean redirectErrorStream) {
 924         this.redirectErrorStream = redirectErrorStream;
 925         return this;
 926     }
 927 
 928     /**
 929      * Starts a new process using the attributes of this process builder.
 930      *
 931      * <p>The new process will
 932      * invoke the command and arguments given by {@link #command()},
 933      * in a working directory as given by {@link #directory()},
 934      * with a process environment as given by {@link #environment()}.
 935      *
 936      * <p>This method checks that the command is a valid operating
 937      * system command.  Which commands are valid is system-dependent,
 938      * but at the very least the command must be a non-empty list of
 939      * non-null strings. 
 940      *
 941      * <p>A minimal set of system dependent environment variables may 
 942      * be required to start a process on some operating systems. 
 943      * As a result, the subprocess may inherit additional environment variable 
 944      * settings beyond those in the process builder's {@link #environment()}.
 945      *
 946      * <p>If there is a security manager, its
 947      * {@link SecurityManager#checkExec checkExec}
 948      * method is called with the first component of this object's
 949      * {@code command} array as its argument. This may result in
 950      * a {@link SecurityException} being thrown.
 951      *
 952      * <p>Starting an operating system process is highly system-dependent.
 953      * Among the many things that can go wrong are:
 954      * <ul>
 955      * <li>The operating system program file was not found.
 956      * <li>Access to the program file was denied.
 957      * <li>The working directory does not exist.
 958      * </ul>
 959      *
 960      * <p>In such cases an exception will be thrown.  The exact nature
 961      * of the exception is system-dependent, but it will always be a
 962      * subclass of {@link IOException}.
 963      *
 964      * <p>Subsequent modifications to this process builder will not
 965      * affect the returned {@link Process}.