Here you can find the source of execute(String... commands)
public static void execute(String... commands)
//package com.java2s; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void execute(String... commands) { Process process = null;//from www.ja v a2 s.c om try { process = Runtime.getRuntime().exec(commands); BufferedReader in = new BufferedReader(new InputStreamReader(process.getInputStream())); String line = null; while ((line = in.readLine()) != null) { System.out.println(line); } } catch (IOException e) { e.printStackTrace(); } finally { if (process != null) { process.destroy(); } } } }