java command supports a wide range of options:
All options start with a single hyphen or minus-sign (
-): the GNU/Linux convention of using
-- for "long" options is not supported.
Options must appear before the
<classname> or the
-jar <jarfile> argument to be recognized. Any arguments after them will be treated as arguments to be passed to Java app that is being run.
Options that do not start with
-XX are standard options. You can rely on all Java implementations1 to support any standard option.
Options that start with
-X are non-standard options, and may be withdrawn from one Java version to the next.
Options that start with
-XX are advanced options, and may also be withdrawn.
-D<property>=<value> option is used to set a property in the system
Properties object. This parameter can be repeated to set different properties.
The main options for controlling the heap and stack sizes are documented in Setting the Heap, PermGen and Stack sizes. (Editorial note: Garbage Collector options should be described in the same topic.)
-da options respectively enable and disable Java
-eaoption enables checking of all assertions
-ea:<packagename>...enables checking of assertions in a package and all subpackages.
-ea:<classname>...enables checking of assertions in a class.
-daoption disables checking of all assertions
-da:<packagename>...disables checking of assertions in a package and all subpackages.
-da:<classname>...disables checking of assertions in a class.
-esaoption enables checking for all system classes.
-dsaoption disables checking for all system classes.
The options can be combined. For example.
$ # Enable all assertion checking in non-system classes $ java -ea -dsa MyApp $ # Enable assertions for all classes in a package except for one. $ java -ea:com.wombat.fruitbat... -da:com.wombat.fruitbat.Brickbat MyApp
Note that enabling to assertion checking is liable to alter the behavior of a Java programming.
assertstatement could have unwanted side-effects.
-server options allow you to select between two different forms of the HotSpot VM:
By default, the JVM will run in 64bit mode if possible, depending on the capabilities of the platform. The
-d64 options allow you to select the mode explicitly.
1 - Check the official manual for the
java command. Sometimes a standard option is described as "subject to change".