wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Java Command Line Options Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Java Command Line Options " Watch "Java Command Line Options " New topic
Author

Java Command Line Options

chander shivdasani
Ranch Hand

Joined: Oct 09, 2007
Posts: 206

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?


Enjoy, Chander
SCJP 5, Oracle Certified PL/SQL Developer
chander shivdasani
Ranch Hand

Joined: Oct 09, 2007
Posts: 206

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

Joined: Oct 13, 2005
Posts: 38057
    
  22
Most command-line tools have a - before their options.
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

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.


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java Command Line Options
 
Similar Threads
Run commands in a Java class
Java Private Bytes Increase
Error while starting JVM
Java OS VM Increase
Error while starting JVM