Java Options

suggest change

The java command supports a wide range of options:

Setting system properties with -D

The -D<property>=<value> option is used to set a property in the system Properties object. This parameter can be repeated to set different properties.

Memory, Stack and Garbage Collector options

The main options for controlling the heap and stack sizes are documented in http://stackoverflow.com/documentation/java/2804/java-memory-management/18190/setting-the-heap-permgen-and-stack-sizes. (Editorial note: Garbage Collector options should be described in the same topic.)

Enabling and disabling assertions

The -ea and -da options respectively enable and disable Java assert checking:

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.

Selecting the VM type

The -client and -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 -d32 and -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”.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents