429 * @return A new {@link Process} object for managing the subprocess
430 *
431 * @throws SecurityException
432 * If a security manager exists and its
433 * {@link SecurityManager#checkExec checkExec}
434 * method doesn't allow creation of the subprocess
435 *
436 * @throws IOException
437 * If an I/O error occurs
438 *
439 * @throws NullPointerException
440 * If {@code cmdarray} is {@code null},
441 * or one of the elements of {@code cmdarray} is {@code null}
442 *
443 * @throws IndexOutOfBoundsException
444 * If {@code cmdarray} is an empty array
445 * (has length {@code 0})
446 *
447 * @see ProcessBuilder
448 */
449 public Process exec(String cmdarray[]) throws IOException {
450 return exec(cmdarray, null, null);
451 }
452
453 /**
454 * Executes the specified command and arguments in a separate process
455 * with the specified environment.
456 *
457 * <p>This is a convenience method. An invocation of the form
458 * {@code exec(cmdarray, envp)}
459 * behaves in exactly the same way as the invocation
460 * {@link #exec(String[], String[], File) exec}{@code (cmdarray, envp, null)}.
461 *
462 * @param cmdarray array containing the command to call and
463 * its arguments.
464 *
465 * @param envp array of strings, each element of which
466 * has environment variable settings in the format
467 * <i>name</i>=<i>value</i>, or
468 * {@code null} if the subprocess should inherit
469 * the environment of the current process.
|
429 * @return A new {@link Process} object for managing the subprocess
430 *
431 * @throws SecurityException
432 * If a security manager exists and its
433 * {@link SecurityManager#checkExec checkExec}
434 * method doesn't allow creation of the subprocess
435 *
436 * @throws IOException
437 * If an I/O error occurs
438 *
439 * @throws NullPointerException
440 * If {@code cmdarray} is {@code null},
441 * or one of the elements of {@code cmdarray} is {@code null}
442 *
443 * @throws IndexOutOfBoundsException
444 * If {@code cmdarray} is an empty array
445 * (has length {@code 0})
446 *
447 * @see ProcessBuilder
448 */
449 public Process exec(String[] cmdarray) throws IOException {
450 return exec(cmdarray, null, null);
451 }
452
453 /**
454 * Executes the specified command and arguments in a separate process
455 * with the specified environment.
456 *
457 * <p>This is a convenience method. An invocation of the form
458 * {@code exec(cmdarray, envp)}
459 * behaves in exactly the same way as the invocation
460 * {@link #exec(String[], String[], File) exec}{@code (cmdarray, envp, null)}.
461 *
462 * @param cmdarray array containing the command to call and
463 * its arguments.
464 *
465 * @param envp array of strings, each element of which
466 * has environment variable settings in the format
467 * <i>name</i>=<i>value</i>, or
468 * {@code null} if the subprocess should inherit
469 * the environment of the current process.
|