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);
Answer from assylias on Stack Overflow
🌐
Oracle
docs.oracle.com › javase › 8 › docs › api › java › lang › ProcessBuilder.html
ProcessBuilder (Java Platform SE 8 )
April 21, 2026 - Modifying a process builder's attributes will affect processes subsequently started by that object's start() method, but will never affect previously started processes or the Java process itself. Most error checking is performed by the start() method. It is possible to modify the state of an object so that start() will fail. For example, setting the command attribute to an empty list will not throw an exception unless start() is invoked. Note that this class is not synchronized. If multiple threads access a ProcessBuilder instance concurrently, and at least one of the threads modifies one of the attributes structurally, it must be synchronized externally.
🌐
Baeldung
baeldung.com › home › java › core java › guide to java.lang.processbuilder api
Guide to java.lang.ProcessBuilder API | Baeldung
November 26, 2025 - We’ve made the assumption that the java command is available via the PATH variable · In this next example, we’re going to see how to modify the working environment. But before we do that let’s begin by taking a look at the kind of information we can find in the default environment: ProcessBuilder processBuilder = new ProcessBuilder(); Map<String, String> environment = processBuilder.environment(); environment.forEach((key, value) -> System.out.println(key + value));
🌐
Coderanch
coderanch.com › t › 709883 › java › Add-parameters-ProcessBuilder
Add parameters to ProcessBuilder (Java in General forum at Coderanch)
May 17, 2019 - Add paramters to the ProcessBuilder. The username and the pw is always the same, thats the reason why do this automatically.
🌐
GeeksforGeeks
geeksforgeeks.org › java › java-lang-processbuilder-class-java
Java.lang.ProcessBuilder class in Java - GeeksforGeeks
January 14, 2022 - ProcessBuilder inheritIO(): Sets the source and destination for subprocess standard I/O to be the same as those of the current Java process.
🌐
Mkyong
mkyong.com › home › java › java processbuilder examples
Java ProcessBuilder examples - Mkyong.com
January 19, 2019 - ProcessBuilder processBuilder = new ProcessBuilder(); // -- Linux -- // Run a shell command processBuilder.command("bash", "-c", "ls /home/mkyong/"); // Run a shell script processBuilder.command("path/to/hello.sh"); // -- Windows -- // Run a command processBuilder.command("cmd.exe", "/c", "dir C:\\Users\\mkyong"); // Run a bat file processBuilder.command("C:\\Users\\mkyong\\hello.bat"); Process process = processBuilder.start(); 1.1 Run an external ping command to ping a website 3 times, and display the output. ... package com.mkyong.process; import java.io.BufferedReader; import java.io.IOExce
🌐
Tutorialspoint
tutorialspoint.com › java › lang › processbuilder_command_list.htm
Java ProcessBuilder command() Method
Using command(list) method, we've added a list to the ProcessBuilder. Then we've printed the underlying operating system command name and other details. package com.tutorialspoint; import java.util.ArrayList; import java.util.List; public class ProcessBuilderDemo { public static void main(String[] args) { // create a new list of arguments for our process List<String> list = new ArrayList<>(); list.add("notepad.exe"); // create the process builder ProcessBuilder pb = new ProcessBuilder(list); // add a new argument to the list list.add("text.txt"); // set the command list pb.command(list); // print the new command list System.out.println(pb.command()); } }
🌐
Oracle
docs.oracle.com › javase › 7 › docs › api › java › lang › ProcessBuilder.html
ProcessBuilder (Java Platform SE 7 )
Modifying a process builder's attributes will affect processes subsequently started by that object's start() method, but will never affect previously started processes or the Java process itself. Most error checking is performed by the start() method. It is possible to modify the state of an object so that start() will fail. For example, setting the command attribute to an empty list will not throw an exception unless start() is invoked. Note that this class is not synchronized. If multiple threads access a ProcessBuilder instance concurrently, and at least one of the threads modifies one of the attributes structurally, it must be synchronized externally.
Find elsewhere
🌐
ZetCode
zetcode.com › java › processbuilder
Java ProcessBuilder - creating processes in Java
May 1, 2025 - The other parameters are the options of the program. In order to run a command on Windows machine, we could use the following: processBuilder.command("cmd.exe", "/c", "ping -n 3 google.com"). ... The process is lauched with start. try (var reader = new BufferedReader( new InputStreamReader(process.getInputStream()))) { With the getInputStream method we get the input stream from the standard output of the process. $ java Main.java Február 2022 Ne Po Ut St Št Pi So 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
🌐
Oracle
docs.oracle.com › javase › 6 › docs › api › java › lang › ProcessBuilder.html
ProcessBuilder (Java Platform SE 6)
Modifying a process builder's ... or the Java process itself. Most error checking is performed by the start() method. It is possible to modify the state of an object so that start() will fail. For example, setting the command attribute to an empty list will not throw an exception unless start() is invoked. Note that this class is not synchronized. If multiple threads access a ProcessBuilder instance ...
🌐
Oracle
docs.oracle.com › en › java › javase › 17 › docs › api › java.base › java › lang › ProcessBuilder.html
ProcessBuilder (Java SE 17 & JDK 17)
April 21, 2026 - Modifying a process builder's attributes will affect processes subsequently started by that object's start() method, but will never affect previously started processes or the Java process itself. Most error checking is performed by the start() method. It is possible to modify the state of an object so that start() will fail. For example, setting the command attribute to an empty list will not throw an exception unless start() is invoked. Note that this class is not synchronized. If multiple threads access a ProcessBuilder instance concurrently, and at least one of the threads modifies one of the attributes structurally, it must be synchronized externally.
🌐
Oracle
docs.oracle.com › javase › 9 › docs › api › java › lang › ProcessBuilder.html
ProcessBuilder (Java SE 9 & JDK 9 )
Modifying a process builder's ... or the Java process itself. Most error checking is performed by the start() method. It is possible to modify the state of an object so that start() will fail. For example, setting the command attribute to an empty list will not throw an exception unless start() is invoked. Note that this class is not synchronized. If multiple threads access a ProcessBuilder instance ...
🌐
Microsoft Learn
learn.microsoft.com › en-us › dotnet › api › java.lang.processbuilder.-ctor
ProcessBuilder Constructor (Java.Lang) | Microsoft Learn
Java.Lang · Assembly: Mono.Android.dll · Important · Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here. Constructs a process builder with the specified operating system program and arguments. [Android.Runtime.Register(".ctor", "(Ljava/util/List;)V", "")] public ProcessBuilder(System.Collections.Generic.IList<string>? command); [<Android.Runtime.Register(".ctor", "(Ljava/util/List;)V", "")>] new Java.Lang.ProcessBuilder : System.Collections.Generic.IList<string> -> Java.Lang.ProcessBuilder ·
🌐
Classpath
developer.classpath.org › doc › java › lang › ProcessBuilder.html
ProcessBuilder (GNU Classpath 0.95 Documentation)
Starts execution of a new process, based on the attributes of this ProcessBuilder object. This is the point at which the command-line arguments are checked. The list must be non-empty and contain only non-null string objects.
🌐
Apache NetBeans
bits.netbeans.org › 18 › javadoc › org-netbeans-modules-extexecution › org › netbeans › api › extexecution › ProcessBuilder.html
ProcessBuilder (External Execution API)
Parameters: arguments - the arguments passed to the process · public void setEnvironmentVariables(@NonNull Map<String,String> envVariables) Deprecated. Sets the environment variables for the process created by subsequent call of ProcessBuilder.call(). By default there are no environment variables ...
🌐
Oracle
docs.oracle.com › en › java › javase › 11 › docs › api › java.base › java › lang › ProcessBuilder.html
ProcessBuilder (Java SE 11 & JDK 11 )
January 20, 2026 - Modifying a process builder's ... or the Java process itself. Most error checking is performed by the start() method. It is possible to modify the state of an object so that start() will fail. For example, setting the command attribute to an empty list will not throw an exception unless start() is invoked. Note that this class is not synchronized. If multiple threads access a ProcessBuilder instance ...
🌐
Oracle
docs.oracle.com › en › java › javase › 21 › docs › api › java.base › java › lang › ProcessBuilder.html
ProcessBuilder (Java SE 21 & JDK 21)
January 20, 2026 - Modifying a process builder's attributes will affect processes subsequently started by that object's start() method, but will never affect previously started processes or the Java process itself. Most error checking is performed by the start() method. It is possible to modify the state of an object so that start() will fail. For example, setting the command attribute to an empty list will not throw an exception unless start() is invoked. Note that this class is not synchronized. If multiple threads access a ProcessBuilder instance concurrently, and at least one of the threads modifies one of the attributes structurally, it must be synchronized externally.
🌐
Microsoft Learn
learn.microsoft.com › en-us › dotnet › api › java.lang.processbuilder
ProcessBuilder Class (Java.Lang) | Microsoft Learn
[<Android.Runtime.Register("java/lang/ProcessBuilder", DoNotGenerateAcw=true)>] type ProcessBuilder = class inherit Object