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:


Java command: java and javaw:
* Java Options

Table Of Contents
8 Arrays
10 Maps
11 Strings
25 JAXB
29 Enums
32 Audio
41 Scanner
63 Logging
75 Lists
78 Sets
89 JAX-WS
96 XJC
98 Process
106 Modules
114 Applets
122 JNDI
125 Java command: java and javaw
139 JavaBean
141 Literals
144 Packages
150 JMX
153 JShell
159 Sockets
167 Enum Map
175 Hashtable
177 SortedMap