Each argument you pass to ProcessBuilder
will be an argument passed to the command, for example...
Process process = new ProcessBuilder("colorDescriptor.exe", "image.jpg", " --detector densesampling "," --ds_spacing 6", " --ds_scales 1.2 "," --descriptor opponentsift ", " --output out.descr").start();
Will result in an array of arguments been passed to the executable, resulting in an array with 6 elements in it...
- "image.jpg"
- " --detector densesampling "
- " --ds_spacing 6"
- " --ds_scales 1.2 "
- " --descriptor opponentsift "
- " --output out.descr"
While this might not not seem like much, normally, each space would produce an individual element in the arguments array...
Process process = new ProcessBuilder(
"colorDescriptor.exe",
"image.jpg",
"--detector", "densesampling",
"--ds_spacing", "6",
"--ds_scales", "1.2",
"--descriptor", "opponentsift",
"--output", "out.descr").start();
The great thing about ProcessBuilder
is you don't need to try an quote or escape spaces, really handy if you need to pass a path that contains spaces.