public static int callProgram(String commandLine, OutputStream stdOutStream, OutputStream stdErrStream) throws IOException { return callProgram(commandLine, stdOutStream, stdErrStream, null); }
/** * Executes the specified command using a shell. On windows uses cmd.exe or * command.exe. On other platforms it uses /bin/sh. * <p> * A shell should be used to execute commands when features such as file * redirection, pipes, argument parsing are desired. * <p> * Output from the process is expected to be text in the system's default * character set. * <p> * No input is passed to the process on STDIN. * * @param command * String containing a command to be parsed by the shell and * executed. * @return The results of the execution in an ExecHelper object. * @throws SecurityException * if a security manager exists and its checkExec method doesn't * allow creation of a subprocess. * @throws IOException - * if an I/O error occurs * @throws NullPointerException - * if command is null * * */ public static ExecHelper execUsingShell(String command) throws IOException { return execUsingShell(command, null); }
public static int callProgram(String[] args, File workDir) throws IOException { Process p = Runtime.getRuntime().exec(args, null, workDir); return processProgram(p); }
/** * Executes the specified command and arguments in a separate process, and * waits for the process to finish. * <p> * No input is passed to the process on STDIN. * * @param cmdarray * array containing the command to call and its arguments. * @param charset * Output from the executed command is expected to be in this * character set. * @return The results of the execution in an ExecHelper object. * @throws SecurityException * if a security manager exists and its checkExec method doesn't * allow creation of a subprocess. * @throws IOException - * if an I/O error occurs * @throws NullPointerException - * if cmdarray is null * @throws IndexOutOfBoundsException - * if cmdarray is an empty array (has length 0). * * */ public static ExecHelper exec(String[] cmdarray, String charset) throws IOException { return new ExecHelper(Runtime.getRuntime().exec(cmdarray), charset); }
public static int callProgram(String commandLine, Logger logger) throws IOException { return callProgram(commandLine, logger, null); }
/** * Executes the specified command and arguments in a separate process, and * waits for the process to finish. * <p> * Output from the process is expected to be text in the system's default * character set. * <p> * No input is passed to the process on STDIN. * * @param cmdarray * array containing the command to call and its arguments. * @return The results of the execution in an ExecHelper object. * @throws SecurityException * if a security manager exists and its checkExec method doesn't * allow creation of a subprocess. * @throws IOException - * if an I/O error occurs * @throws NullPointerException - * if cmdarray is null * @throws IndexOutOfBoundsException - * if cmdarray is an empty array (has length 0). * * */ public static ExecHelper exec(String[] cmdarray) throws IOException { return new ExecHelper(Runtime.getRuntime().exec(cmdarray), null); }
public static int callProgram(String commandLine, File workDir) throws IOException { Process p = Runtime.getRuntime().exec(commandLine, null, workDir); return processProgram(p); }
/** * Executes the specified command using a shell. On windows uses cmd.exe or * command.exe. On other platforms it uses /bin/sh. * <p> * A shell should be used to execute commands when features such as file * redirection, pipes, argument parsing are desired. * <p> * Output from the process is expected to be text in the system's default * character set. * <p> * No input is passed to the process on STDIN. * * @param command * String containing a command to be parsed by the shell and * executed. * @return The results of the execution in an ExecHelper object. * @throws SecurityException * if a security manager exists and its checkExec method doesn't * allow creation of a subprocess. * @throws IOException - * if an I/O error occurs * @throws NullPointerException - * if command is null * * */ public static ExecHelper execUsingShell(String command) throws IOException { return execUsingShell(command, null); }
public static int callProgram(String commandLine, OutputStream stdOutStream, OutputStream stdErrStream) throws IOException { return callProgram(commandLine, stdOutStream, stdErrStream, null); }
/** * Executes the specified command and arguments in a separate process, and * waits for the process to finish. * <p> * Output from the process is expected to be text in the system's default * character set. * <p> * No input is passed to the process on STDIN. * * @param cmdarray * array containing the command to call and its arguments. * @return The results of the execution in an ExecHelper object. * @throws SecurityException * if a security manager exists and its checkExec method doesn't * allow creation of a subprocess. * @throws IOException - * if an I/O error occurs * @throws NullPointerException - * if cmdarray is null * @throws IndexOutOfBoundsException - * if cmdarray is an empty array (has length 0). * * */ public static ExecHelper exec(String[] cmdarray) throws IOException { return new ExecHelper(Runtime.getRuntime().exec(cmdarray), null); }
public static int callProgram(String[] args, File workDir) throws IOException { Process p = Runtime.getRuntime().exec(args, null, workDir); return processProgram(p); }
public static int callProgram(String commandLine, Logger logger) throws IOException { return callProgram(commandLine, logger, null); }
/** * Executes the specified command and arguments in a separate process, and * waits for the process to finish. * <p> * No input is passed to the process on STDIN. * * @param cmdarray * array containing the command to call and its arguments. * @param charset * Output from the executed command is expected to be in this * character set. * @return The results of the execution in an ExecHelper object. * @throws SecurityException * if a security manager exists and its checkExec method doesn't * allow creation of a subprocess. * @throws IOException - * if an I/O error occurs * @throws NullPointerException - * if cmdarray is null * @throws IndexOutOfBoundsException - * if cmdarray is an empty array (has length 0). * * */ public static ExecHelper exec(String[] cmdarray, String charset) throws IOException { return new ExecHelper(Runtime.getRuntime().exec(cmdarray), charset); }
public static int callProgram(String commandLine, File workDir) throws IOException { Process p = Runtime.getRuntime().exec(commandLine, null, workDir); return processProgram(p); }
return new ExecHelper(Runtime.getRuntime().exec(cmdarray, envp), null);
return new ExecHelper(Runtime.getRuntime().exec(cmdarray, envp), null);
return new ExecHelper(Runtime.getRuntime().exec(cmdarray, envp, dir), charset);
return new ExecHelper(Runtime.getRuntime().exec(cmdarray, envp), charset);