try {
String cmd = "cmd.exe /c http://www.google.com/";
Process process = Runtime.getRuntime().exec("cmd.exe /c start http://www.google.com/");
//use ping
Process ee = Runtime.getRuntime().exec(
"cmd.exe /c start ping www.google.com");
// build the ".java" to ".class"
Process jac = Runtime.getRuntime().exec(
"cmd.exe /c start javac C://testapp//Main.java");
// compile to ".jar" file
Process jar = Runtime.getRuntime().exec(
"cmd.exe /c start jar cvf D://jello.jar C://testapp//Main.class");// to different directry.
} catch (Exception e) {
e.printStackTrace();
}