Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java Command Line Options

 
chander shivdasani
Ranch Hand
Posts: 206
Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
While using Java Options, i found they are of two types. One that has "-" as a prefix and another as "+". For example:

-XX:-UseParallelGC

XX:+UseThreadPriorities


Is there some reason why we have both "+" as well as "-". Initially, i thought that + would mean enabling while - would mean disabling. But, if we want any option disabled than why even pass it along the command line?

 
chander shivdasani
Ranch Hand
Posts: 206
Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I figured the answer:

"Initially, i thought that + would mean enabling while - would mean disabling"

The official documentation suggests that these options are turned on/off with +/-

"But, if we want any option disabled than why even pass it along the command line?"

That's because some may be enabled and others disabled per default, and this may change between Java releases.
 
Campbell Ritchie
Sheriff
Pie
Posts: 50242
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Most command-line tools have a - before their options.
 
Wouter Oet
Saloon Keeper
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The + and - can be used to turn on and off boolean options of the jvm. For a list of options of the java jvm see this.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic