Java exec execSystemCommand(String[] commands, String executionPath)

Here you can find the source of execSystemCommand(String[] commands, String executionPath)

Description

exec System Command

License

Open Source License

Declaration

public static boolean execSystemCommand(String[] commands,
            String executionPath) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.File;

import java.io.IOException;

public class Main {
    public static boolean execSystemCommand(String[] commands,
            String executionPath) {

        try {/*from  w w  w  . j  av a  2  s  . c  om*/
            File handler = new File(executionPath);

            Runtime rt = Runtime.getRuntime();
            Process p1 = rt.exec(commands, null, handler);

            p1.waitFor();

        } catch (InterruptedException e) {
            e.printStackTrace();
            return false;
        } catch (IOException e) {
            e.printStackTrace();
            return false;
        }
        return true;
    }
}

Related

  1. Execption2Strings(boolean rep, Throwable... execptions)
  2. execScript(File shellScriptFile, String[] scriptCommand, PrintWriter execLog)
  3. execShell(String cmd)
  4. execShell(String shell)
  5. execSudoCommand(final String _sudoCmd, final String _pw)
  6. execToString(final String... args)
  7. execute(boolean returnOutput, boolean returnError, boolean throwException, String[] cmd, File dir, String[] env)
  8. execute(final String applicationName, final String workingDirectory)
  9. execute(final String command)