I have a ProcessBuilder:
String src = c:/hello/
String dst = c:/hello/2
ProcessBuilder builder = null;
builder = new ProcessBuilder("c:/file/file.exe", "-i", src, "-f", "-l 500", dst);
builder.redirectErrorStream(true);
process = builder.start();
The problem is that as soon as I add "-l 500"
I get output:
"l 500" invalid command
Even though I've inputed "-l 500"
and not "l 500"
. If I input "--l 500"
I get:
"-l 500" invalid command
Even though -l 500
IS a valid command when running it in command prompt.
If I REMOVE "-l 500"
it works again.
Am I using Processbuilder wrong?
EDIT:
Ok it seems as if it works if I do "-l" and "500" as separate entries like this:
new ProcessBuilder("c:/file/file.exe", "-i", src, "-f", "-l", "500", dst);
Why is this so? Can't I have a command with space in it as the same entry?