Command line arguments are aggregated into an String[] in Java and passed into your main un-processed.

public static void main(final String[] args) { // code }

With your example input of D:/input a.conf,b.conf,c.conf D:/output the value of args becomes ["D:/input", "a.conf,b.conf,c.conf", "D:/output"] where the [] delimit an array of String.

You have two options:

  1. manually parse this args array and pull it apart manually and process each element yourself. In this case you need to Arrays.asList(args[2].split(",")); the second argument to get it into a List<String> as you desire.
  2. Use something like JSAP ( Java Simple Argument Parser ) and let a well tested and mature library parse, validate and format the input for you. Specifically it can parse the second argument you are passing in for you.

Needless to say, I prefer the second option because the first is just brittle busy work.

Answer from user177800 on Stack Overflow
🌐
GeeksforGeeks
geeksforgeeks.org › java › command-line-arguments-in-java
Command Line Arguments in Java - GeeksforGeeks
Explanation: When the program is executed using java Hello Geeks at GeeksforGeeks, the JVM stores the three command-line arguments in the args array as args[0] = "Geeks", args[1] = "at", and args[2] = "GeeksforGeeks".
Published: September 28, 2026
🌐
Oracle
docs.oracle.com › javase › tutorial › essential › environment › cmdLineArgs.html
Command-Line Arguments (The Java™ Tutorials > Essential Java Classes > The Platform Environment)
The Echo example displays each of its command-line arguments on a line by itself: public class Echo { public static void main (String[] args) { for (String s: args) { System.out.println(s); } } } The following example shows how a user might run Echo. User input is in italics. ... Note that the application displays each word — Drink, Hot, and Java — on a line by itself.
Discussions

List<String> as command line argument in java - Stack Overflow
I want to give 3 inputs as command line arguments in Java: inputFileLocation configFileList outputFileLocation But I am not able to understand how to give list as command line arguement. I tried More on stackoverflow.com
🌐 stackoverflow.com
Minecraft Forge: JVM flags for high performance. (Working on low spec and high spec pc´s)
Since I am using MultiMc I can't use the -Xmx or -Xms command line but I will try these args and see what happens. My game has been very laggy at points and freezing at others with the ones from CPW. More on reddit.com
🌐 r/feedthebeast
53
121
February 9, 2021
Issues passing command line arguments in launch.json

the file isn't found

IDK how the Java extension in particular deals with this but this sounds like working directory / relative path type whatnot. The program may be looking for the file in a different folder than it actually is. See here for more info - adding ${workspaceFolder} into the mix and/or "cwd" should do the job.

No clue about the "argument not received" stuff though.

More on reddit.com
🌐 r/vscode
2
1
March 1, 2020
Is there any good library to handle command-line arguments?
You may have a look at https://hackage.haskell.org/package/optparse-applicative More on reddit.com
🌐 r/haskell
15
22
February 28, 2015
People also ask

How to run a Java class using the command line?
To run a Java class using command line i.e. from shell prompt simply type the command java -jar jar_file.jar where jar_file.jar is the name of your JAR file (e.g. QuoraAnswerManager.jar). The simplest way to run a Java class in the command line is to compile it and provide a classpath to it. Compile your Java class with the following command: javac -classpath classpathMainFolder myClass.java. Then run the compiled class with the following command: java -classpath classpathMainFolder myClass.
🌐
upgrad.com
upgrad.com › home › blog › software development › command line arguments in java [with example]
Command Line Arguments in Java [With Example] | upGrad blog
What are jar files in Java?
In Java there are many types of jar files. Jar files are simply packages. The JAR file format was originally created for Java and was intended for software distribution. JAR files are sometimes called JAR archives because they function similarly to a ZIP file, in that they store multiple files and directories within a single file for easy distribution. A JAR file is sometimes referred to as a Java Archive. This is not technically correct, but is often used in the Java community where both the word archive and packaging are sometimes used to refer to JAR files.
🌐
upgrad.com
upgrad.com › home › blog › software development › command line arguments in java [with example]
Command Line Arguments in Java [With Example] | upGrad blog
🌐
Programiz
programiz.com › java-programming › command-line-arguments
Java Command-Line Arguments | Programiz
March 13, 2024 - The String array stores all the arguments passed through the command line. Note: Arguments are always stored as strings and always separated by white-space. The main() method of every Java program only accepts string arguments.
🌐
Baeldung
baeldung.com › home › java › core java › command-line arguments in java
Command-Line Arguments in Java | Baeldung
September 16, 2026 - Note that in some languages, the first argument will be the name of the application. On the other hand, in Java, this array contains only the arguments. Now that we have an application that handles command-line arguments, we’re eager to try it.
🌐
TechVidvan
techvidvan.com › tutorials › java-command-line-arguments
Java Command Line Arguments with Examples - TechVidvan
April 9, 2020 - The command-line arguments in Java allow the programmers to pass the arguments during the execution of a program.
🌐
Edureka
edureka.co › blog › java-command-line-argument
Java Command Line Arguments With Examples | Java Tutorial | Edureka
August 27, 2024 - The command-line arguments are stored in the String args of the main() method of the program. Related Learning: Java Interview Questions for 3 Years Experience
Find elsewhere
🌐
Oracle
docs.oracle.com › en › java › javase › 25 › docs › specs › man › java.html
The java Command
July 21, 2026 - JDK_JAVA_OPTIONS prepends its content to the options parsed from the command line. The content of the JDK_JAVA_OPTIONS environment variable is a list of arguments separated by white-space characters (as determined by isspace()). These are prepended to the command line arguments passed to java launcher.
🌐
Upgrad
upgrad.com › home › blog › software development › command line arguments in java [with example]
Command Line Arguments in Java [With Example] | upGrad blog
August 11, 2026 - After you have completed compiling it successfully, you now need to run the command by writing arguments- java CommandLine argument-list (for instance – java CommandLine upGrad Java Tutorial) ...
🌐
Coding Shuttle
codingshuttle.com › home › handbooks › java programming handbook › java commandline arguments
Java CommandLine Arguments | Coding Shuttle
April 9, 2025 - Java allows us to pass arguments to the main() method when running a program from the command line.
🌐
Caltech
courses.cms.caltech.edu › cs11 › material › java › donnie › java-main.html
Java Program Invocation and Command-Line Arguments
For the above command-line invocation, the first two arguments are "1234" and "www.caltech.edu", since the Java VM will divide the argument list based on whitespace.
🌐
Tutorialspoint
tutorialspoint.com › java › java-command-line-args.htm
Java - Command Line Arguments
The Java Virtual Machine (JVM) encapsulates these inputs into the args[] array. We can check the number of arguments passed using args.length. In case no command line argument is present, then this array is empty.
🌐
CodeGym
codegym.cc › java blog › core java › java command line arguments
Java command line arguments
February 14, 2025 - The command line arguments in java are the arguments passed to the program from the console. The command line argument in java is the information passed to the program at the time of running the program. It is the argument passed through the console when the program is run.
🌐
CS156
ucsb-cs156.github.io › topics › java › java_command_line_arguments.html
Java: Command Line Arguments | CS156 - GitHub Pages
If you run java Main foo bar fum then args.length is 3, args[0] is "foo", args[1] is "bar", and args[2] is "fum" Command line args come in as Strings. If you want an int, use Integer.parseInt as in this example from Oracle’s tutorial · int firstArg; if (args.length > 0) { try { firstArg = Integer.parseInt(args[0]); } catch (NumberFormatException e) { System.err.println("Argument" + args[0] + " must be an integer."); System.exit(1); } }
🌐
Whitman College
whitman.edu › mathematics › java_tutorial › java › cmdLineArgs › cmdLineArgs.html
Command Line Arguments
C:\> java Sort friends.txt In the Java language, when you invoke an application, the runtime system passes the command line arguments to the application's main method via an array of Strings. Each String in the array contains one of the command line arguments.
🌐
HackerNoon
hackernoon.com › command-line-arguments-in-java-for-beginners-p21233y9
Command-Line Arguments In Java For Beginners | HackerNoon
April 3, 2021 - Now that you’ve executed a Java command line class with one argument, let’s look at how this changes with multiple command line arguments: ... This command looks almost the same, but as you can see, there are now four arguments after the name of the program ( one two three four). Each item in your list of command line arguments is separated by space.
🌐
javathinking
javathinking.com › blog › command-line-arguments-in-java
Command-Line Arguments in Java: A Comprehensive Guide — javathinking.com
When you run a Java program from the terminal (e.g., java MyApp arg1 arg2), the strings arg1 and arg2 are command-line arguments.
🌐
Sde-coursepack
sde-coursepack.github.io › modules › java › Command-Line-Arguments
SDE | Command Line Arguments
You’ll notice that Java splits the arguments up by whitespace, and we start with index 0 being the first argument after the program name. To wit, jar above is not included in the command-line arguments array.
🌐
Scientech Easy
scientecheasy.com › home › blog › command line arguments in java
Command Line Arguments in Java - Scientech Easy
February 15, 2025 - For example, suppose that we entered the following command to run CommandLine program from the command prompt, as: ... This command has three command-line arguments beyond the java CommandLine command: hello, 10, and world.
🌐
Upgrad
upgrad.com › home › tutorials › software & tech › command line arguments in java
Command Line Arguments in Java Explained with Examples
August 31, 2026 - The Java Virtual Machine (JVM) automatically captures these inputs and stores them in the String[] args array. ... String[] args: This parameter stores command line arguments as an array of strings.