pass multiple parameters to ProcessBuilder with a space

mee picture mee · Jun 12, 2013 · Viewed 46.5k times · Source

I would like to pass multiple parameters to a processBuilder and the parameters to be separated by a space.

Here is the command,

String[] command_ary = {dir+"library/crc"," -s ", fileName," ",addressRanges};

I need to provide a space after "fcrc" and after "-p" and in between "filename" and the "addressRange".

Thank you

Answer

assylias picture assylias · Jun 12, 2013

You don't need to include spaces. The ProcessBuilder will deal with that for you. Just pass in your arguments one by one, without space:

ProcessBuilder pb = new ProcessBuilder(
                         dir + "library/crc",
                         "-s",
                         fileName,
                         addressRanges);