I will come back with my previous problem when executing a .bat file from a java program.
When I execute my Java code, I don’t understand why it is looking for my .bat file in the project directory of my Eclipse.
I clearly declare the path as follows: "cmd.exe", "/C", "Start", "C:\\File\\batfile.bat"
If someone can explain it clearly to me, please. Thank you very much!
I am using win xp and Eclipse Helios.
here is my code:
String cmd;
try {
String[] command = { "cmd.exe", "/C", "Start", "C:\\File\\batfile.bat" };
Runtime r = Runtime.getRuntime();
Process p = r.exec(command);
p.waitFor();
} catch (Exception e)
{
System.out.println("Execution error");}
source
share