Is there an easier way to specify multiple System Properties on the command line to a Java program rather than having multiple -D statements?
Trying to avoid this:
java -jar -DNAME="myName" -DVERSION="1.0" -DLOCATION="home" program.jar
I thought I had seen an example of someone using one -D and some quoted string after that, but I can’t find the example again.
Answer is NO. You might have seen an example where somebody would have set something like :
-DArguments=a=1,b=2,c=3,d=4,e=cowThen the application would parse value of
Argumentsproperty string to get individual values.In your
mainyou can get the key values as(Assuming input format is guaranteed):Also, the
-Dshould be before the main class or thejarfile in the java command line. Example :java -DArguments=a=1,b=2,c=3,d=4,e=cow MainClass