Here you can find the source of execCmd(String cmd, File where)
public static String execCmd(String cmd, File where) throws Exception
//package com.java2s; import java.io.File; import java.util.Scanner; public class Main { public static String execCmd(String cmd, File where) throws Exception { Process p = Runtime.getRuntime().exec(cmd, null, where); Scanner s = new Scanner(p.getInputStream()); String ret = ""; s.useDelimiter("\\A"); if (s.hasNext()) ret = s.next();/* w w w. j a va2s .com*/ s.close(); return ret; } }