Here you can find the source of execute(String command)
public static boolean execute(String command)
//package com.java2s; import java.io.IOException; public class Main { public static boolean execute(String command) { try {/* w ww. j av a 2 s . co m*/ Process p = Runtime.getRuntime().exec(command); return (p.waitFor() == 0); } catch (IOException e) { return false; } catch (InterruptedException e) { return false; } } }