Re: JButton and Execute Windows Batch File





try:

....
Runtime r = Runtime.getRuntime();
Process p = null;
String cmd = "c://test.bat";
try {
p = r.exec(cmd);

p.waitFor(); //to wait to execute command

} catch (Exception e) {
System.out.println("error executing " + cmd);
}
System.out.println(cmd + " returned " + p.exitValue());

.