Here you can find the source of execute(String[] _command, String _workingDir)
public static boolean execute(String[] _command, String _workingDir)
//package com.java2s; //License from project: Apache License import java.io.BufferedReader; import java.io.File; import java.io.InputStreamReader; public class Main { public static boolean execute(String[] _command, String _workingDir) { try {/*from w w w. ja va 2 s . co m*/ Process p = Runtime.getRuntime().exec(_command, null, new File(_workingDir)); BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream())); String line = ""; while ((line = reader.readLine()) != null) { System.out.println(line); } int exitVal = p.waitFor(); //System.out.println("exec result : "+exitVal); reader.close(); } catch (Exception e) { e.printStackTrace(); return false; } return true; } }