Runtime.exec doesn't do anything… (no errors)-Collection of common programming errors
I am trying to use java to run a batch file at an absolute location. The batch file will compile a couple of java files.
Here is the code which I have been trying:
String s=file.getAbsolutePath() + "\\compile.bat";
Runtime rut = Runtime.getRuntime();
try {
rut.exec(new String[] {file.getAbsolutePath() + "\\compile.bat"});
}catch(IOException e1) {
e1.printStackTrace();
}
System.out.println(s);
Now, when this code gets executed, I get no console errors, but the batch file is not run. When I run the batch file through Windows Explorer, however, the batch file works, compiles the files and closes when done.