Reputation: 358
I am trying to execute a jar file. It needs both program arguments and the jvm arguments. Do we need to do something different while passing the command line parameters in order for it to be able to differentiate them, or it will be handled automatically?
Currently I am using eclipse IDE, so I can configure it. However it will be finally run using command line only. Please let me know if something needs to be done differently.
Upvotes: 4
Views: 1968
Reputation: 1491
I assume you're using java -jar file.jar
? It's the same as if you used java MainClass
. JVM arguments like -ea
, -cp
, -classpath
, -X...
, -D...
, etc. are targeted to the VM while all other arguments are targeted to your app.
Upvotes: 0
Reputation: 10346
Well, the JVM arguments are typed before using '-D', then after the jar file you'll type your program arguments:
java -Djvm_argument1=XXX -Djvm_argument2=YYY -jar myjar.jar my_argument1 my_argument2
Upvotes: 6