public static Process execute(String command, AbstractFile currentFolder) throws IOException { if(Debug.ON) Debug.trace("Executing " + command);   Vector commandTokens = splitCommand(getShellCommand()); commandTokens.add(command);   File workingDirectory = new java.io.File((currentFolder instanceof FSFile) ? currentFolder.getAbsolutePath() : System.getProperty("user.home"));   ShellHistoryManager.add(command);     if(PlatformManager.JAVA_VERSION >= PlatformManager.JAVA_1_5) { ProcessBuilder pb = new ProcessBuilder(commandTokens);  pb.directory(workingDirectory);  pb.redirectErrorStream(true);  return pb.start(); }  else {  String tokens[] = new String[commandTokens.size()]; commandTokens.toArray(tokens);  return Runtime.getRuntime().exec(tokens, null, workingDirectory); } }
public static Process execute(String command, AbstractFile currentFolder) throws IOException {return execute(command, currentFolder, null);}
    public static Process execute(String command, AbstractFile currentFolder) throws IOException {        if(Debug.ON) Debug.trace("Executing " + command);        // Stores the command as a vector.        Vector commandTokens = splitCommand(getShellCommand());        commandTokens.add(command);                // Determine if specified folder can be used as a working directory        File workingDirectory = new java.io.File((currentFolder instanceof FSFile) ?            currentFolder.getAbsolutePath() :            System.getProperty("user.home"));        // Adds the command to history.        ShellHistoryManager.add(command);        // Under Java 1.5 and up, use ProcessBuilder to merge the created process's output and error streams.        // The benefit of doing so is that error messages will be displayed in the context of the normal process' output        // (mixed), whereas otherwise error messages are displayed after all normal output has been read and displayed.        if(PlatformManager.JAVA_VERSION >= PlatformManager.JAVA_1_5) {            ProcessBuilder pb = new ProcessBuilder(commandTokens);            // Set the process' working directory            pb.directory(workingDirectory);            // Merge the process' stdout and stderr             pb.redirectErrorStream(true);            return pb.start();        }        // Java 1.4 or below, use Runtime.exec() which separates stdout and stderr (harder to manipulate)         else {            // Stores the tokens in an array for Runtime.exec(String[],String[],File).            String tokens[] = new String[commandTokens.size()];            commandTokens.toArray(tokens);            return Runtime.getRuntime().exec(tokens, null, workingDirectory);        }    }