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 the output:
"l 500" invalid command
Although I entered "-l 500" and not "l 500" . If I enter "--l 500" , I get:
"- l 500" invalid command
Even if -l 500 is a valid command when run at a command prompt.
If I REMOVE "-l 500" , it works again.
Am I using Processbuilder incorrectly?
EDIT:
It seems good that it works if I do "-l" and "500" as separate entries:
new ProcessBuilder("c:/file/file.exe", "-i", src, "-f", "-l", "500", dst);
Why is this so? Can I have a command with a space in it as the same record?
source share