i have a bat file that i want to run from a java program that creates that bat file. Ive looked around but i dont see anything straight forward. something about a runtime class? Can anyone help me out? Thanks.
Posted 02 May 2012 - 05:53
import java.io.*;
public class CmdExec {
public static void main(String argv[]) {
try {
String line;
Process p = Runtime.getRuntime().exec("test.cmd");
p.waitFor();
System.out.println(p.exitValue());
}
catch (Exception err) {
err.printStackTrace();
}
}
}