This example program will execute the external commands and capture the output.
import java.io.*;
public class CommandExection {
public CommandExection(String commandline) {
try {
String line;
Process p = Runtime.getRuntime().exec(commandline);
BufferedReader input =
new BufferedReader
(new InputStreamReader(p.getInputStream()));
while ((line = input.readLine()) != null) {
System.out.println(line);
}
input.close();
} catch (Exception err) {
err.printStackTrace();
}
}
public static void main(String argv[]) {
new CommandExection("c:\\CompChamps.exe");
}