Results 1 to 3 of 3
- 11-08-2009, 10:35 PM #1
Member
- Join Date
- Nov 2009
- Posts
- 1
- Rep Power
- 0
problem with Runtime.getRuntime().exec when running java in .bat
hey,
in my code i'm using Runtime.getRuntime().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.getRuntime().exec("cmd /c start C:\\MyFolder\\JavaApp.bat");
the seperate process runs perfectly, but when i add a space to the path:
Process process = Runtime.getRuntime().exec("cmd /c start \"C:\\My Folder\\JavaApp.bat\"");
then the java.exe refuses to load and all i get is an empty cmd with only "C:\"...
i also tried running this line with a ProcessBuilder, but that didn't work as well.
the .bat file has to be under C:\Program Files, so moving it under a folder without a space in its path is not an option.
does anyone know how can i pass through this problem?
thnx.
- 11-10-2009, 03:46 AM #2
does passing quotes to the command being executed work ?
where I added \" before and after C:....Java Code:Process process = Runtime.getRuntime().exec("cmd /c start \"C:\\My Folder\JavaApp.bat\"");
- 01-27-2010, 07:46 PM #3
Member
- Join Date
- Jan 2010
- Posts
- 1
- Rep Power
- 0
Similar Threads
-
Problem with Runtime.getRuntime().exec with Linux Commands
By swapnilnawale in forum Threads and SynchronizationReplies: 1Last Post: 09-23-2009, 10:23 PM -
Running system comman with special symbols using Runtime.exec()
By sda in forum New To JavaReplies: 0Last Post: 07-13-2009, 05:22 PM -
To start external program with Runtime.getRuntime().exec(...) in foreground
By tilex in forum AWT / SwingReplies: 3Last Post: 04-02-2009, 08:16 PM -
grep on multiple files using Runtime.getRuntime().exec()
By cprash.aggarwal in forum Advanced JavaReplies: 3Last Post: 02-11-2009, 06:55 AM -
help with "Runtime.getRuntime().exec(this.command);"
By itaipee in forum New To JavaReplies: 6Last Post: 12-29-2008, 02:47 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks