i tried this method already and it didn't work.
notice i wrote \"C:\\My Folder\\JavaApp .bat\" which means it's supposed to be read by java as one argument.
by the way if i have a .bat file that contains:
"start /b notpad
start /b calc
start /b java -cp args..."
and i run it like this:
Process process = Runtime.getRunt ime().exec("\"C :\\My Folder\\JavaApp .bat\"");...
User Profile
Collapse
-
Problem with Runtime.getRuntime().exec when running java in .bat
hey,
in my code i'm using Runtime.getRunt ime().exec() in order to run a .bat file that calls another java program (they communicate with each other using RMI).
when i call:
Process process = Runtime.getRunt ime().exec("cmd /c start C:\\MyFolder\\J avaApp.bat");
the seperate process runs perfectly, but when i add a space to the path:
Process process = Runtime.getRunt ime().exec("cmd /c start \"C:\\My...
No activity results to display
Show More
Leave a comment: