Java run command line which contains spaces-Collection of common programming errors

I’m trying to run a .bat file from my Java app. I’ve tried all the methods I could find, but none seems to work.

The problem is that the path to the .bat file containing spaces.

I’m using this method now so I can see the results in my Eclipse console http://viralpatel.net/blogs/how-to-execute-command-prompt-command-view-output-java/

My actual code is:

Runtime rt = Runtime.getRuntime();
String processString = "cmd /c \"" + homeFolder.getAbsolutePath() + SETUP_FILE + "\" \"" + homeFolder.getAbsolutePath() + "\"";
    try {
        Process proc = rt.exec(processString);
    ...
    }

I’ve tried with escaping the quotes, without escaping quotes, separating the string into String[] and placing each space separated command its own cell:

{ "cmd", "/c", \"" + homeFolder.getAbsolutePath() + SETUP_FILE + "\" ... };

Again, with and without escaping the quotes: nothing works.

I also tried hard-coding the paths to both the array and the string. Same results every time.

homeFolder = C:\Users\La bla bla\workspace\ToolMaker\bin\
SETUP_FILE = setup.bat

The whole command is this:

cmd /c "C:\Users\La bla bla\workspace\ToolMaker\bin\setup.bat" "C:\Users\La bla bla\workspace\ToolMaker\bin"

Again, with or without quotes, same output:

Output: 
Error: 'C:\Users\La' is not recognized as an internal or external command,operable program or batch file.

Obviously I’m running on Windows (7, 64 bit professional). Java 7

I saw a few people said they had this issues before, but I couldn’t find an answer on how to get around that.