Here you can find the source of executeLocalCommand(String[] command)
public static String executeLocalCommand(String[] command)
//package com.java2s; import java.io.*; public class Main { public static String executeLocalCommand(String[] command) { StringBuffer output = new StringBuffer(); Process p;/*from ww w . j a va 2 s . c o m*/ try { p = Runtime.getRuntime().exec(command); p.waitFor(); BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream())); String line = ""; while ((line = reader.readLine()) != null) { output.append(line + "\n"); } reader = new BufferedReader(new InputStreamReader(p.getErrorStream())); line = ""; while ((line = reader.readLine()) != null) { output.append(line + "\n"); } } catch (Exception e) { e.printStackTrace(); } return output.toString(); } }