Here you can find the source of execCmd(String cmd)
public static int execCmd(String cmd) throws IOException
//package com.java2s; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static int execCmd(String cmd) throws IOException { Process p = Runtime.getRuntime().exec(cmd); BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream())); String line = null;/*from ww w. ja va 2 s . c o m*/ while ((line = in.readLine()) != null) { System.out.println(line); } return 0; } }