Here you can find the source of execute(final String command)
public static final synchronized String execute(final String command) throws IOException, InterruptedException
//package com.java2s; //License from project: Open Source License import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static final synchronized String execute(final String command) throws IOException, InterruptedException { StringBuilder output = new StringBuilder(); Process p;/*w w w.ja v a 2 s.com*/ 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).append("\n"); } return output.toString(); } }