Java Runtime Options
Join the DZone community and get the full member experience.Join For Free
The Java runtime is a complex beast – and it has to be since it runs officially on seven platforms and unofficially on many more. Give this, it is normal that there are many knobs and dials to control how things function. The more well known ones are:
- -Xmx for the maximum heap size
- -client and -server for selecting the default set of parameters from classes of defaults
- -XX:MaxPermGen for controlling the permanent generation size
Other than these, it is (very) rarely the case that you need to change the defaults. However, thanks to Java being open source you can see the list of options, their default values and a short explanation directly from the source code. Currently there are almost 800 options in there!
An other way to see the options (but one which doesn’t display the explanations unfortunately) is the following command:
java -XX:+UnlockDiagnosticVMOptions -XX:+UnlockDiagnosticVMOptions -XX:+PrintFlagsFinal -version
These options are well worth studying. Not for tweaking them (since there is a wealth of testing behind the defaults the extent of which would be very hard to replicate), but rather to understand the different functionalities offered by the JVM (for example why you might not see stacktraces in exceptions).
Published at DZone with permission of Attila-Mihaly Balazs, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.