I am creating a process using the below 2 lines
Runtime rt = Runtime.getRuntime();
Process p = rt.exec(COMMAND);
where COMMAND = "program.exe". program.exe is on the system's PATH variable.
Now the problem is that this does not work only in Windows 2K8 R2. It works fine on every other flavour of windows (winXP, win2003)
The error reported is :
java.io.IOException: Cannot run program "program.exe": CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(Unknown Source)
You can run the program manually from the command line. You can run the program from within the parent process using the full path specification. I would say we can assume the program runs properly.
What else could be different? The environment the parent process is running under perhaps? I would check the PATH before launching the process. You are using Java. Too many Java programs use batch files to launch the JVM process. This batch file could be mucking with the PATH variable.
If this is your program and no batch file in involved I would check the current working directory when you run the parent program. It could affect what gets found at runtime as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With