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?