Archive for the ‘JVM’ Tag

HotSpot JVM Options

There are a number of parameters/options you can provide while creating a Java HotSpot VM.
The options fall under the following 3 categories:

  • Standard – To list out the standard options do: java -help

    abhi@abhiltlnx(~)# java -help
    Usage: java [-options] class [args...]
    (to execute a class)
    or  java [-options] -jar jarfile [args...]
    (to execute a jar file)
    where options include:
    -d32          use a 32-bit data model if available
    -d64          use a 64-bit data model if available
    -client       to select the "client" VM
    -server       to select the "server" VM
    -hotspot      is a synonym for the "client" VM  [deprecated]
    The default VM is client.
    -cp 
    -classpath 
    A : separated list of directories, JAR archives,
    and ZIP archives to search for class files.
    -D=
    set a system property
    -verbose[:class|gc|jni]
    enable verbose output
    -version      print product version and exit
    -version:
    require the specified version to run
    -showversion  print product version and continue
    -jre-restrict-search | -jre-no-restrict-search
    include/exclude user private JREs in the version search
    -? -help      print this help message
    -X            print help on non-standard options
    -ea[:...|:]
    -enableassertions[:...|:]
    enable assertions
    -da[:...|:]
    -disableassertions[:...|:]
    disable assertions
    -esa | -enablesystemassertions
    enable system assertions
    -dsa | -disablesystemassertions
    disable system assertions
    -agentlib:[=]
    load native agent library , e.g. -agentlib:hprof
    see also, -agentlib:jdwp=help and -agentlib:hprof=help
    -agentpath:[=]
    load native agent library by full pathname
    -javaagent:[=]
    load Java programming language agent, see java.lang.instrument
    -splash:
    show splash screen with specified image
    
  • Non-Standard – To list them out do: java -X

    abhi@abhiltlnx(~)# java -X
    -Xmixed           mixed mode execution (default)
    -Xint             interpreted mode execution only
    -Xbootclasspath:
    set search path for bootstrap classes and resources
    -Xbootclasspath/a:
    append to end of bootstrap class path
    -Xbootclasspath/p:
    prepend in front of bootstrap class path
    -Xnoclassgc       disable class garbage collection
    -Xincgc           enable incremental garbage collection
    -Xloggc:    log GC status to a file with time stamps
    -Xbatch           disable background compilation
    -Xms        set initial Java heap size
    -Xmx        set maximum Java heap size
    -Xss        set java thread stack size
    -Xprof            output cpu profiling data
    -Xfuture          enable strictest checks, anticipating future default
    -Xrs              reduce use of OS signals by Java/VM (see documentation)
    -Xcheck:jni       perform additional checks for JNI functions
    -Xshare:off       do not attempt to use shared class data
    -Xshare:auto      use shared class data if possible (default)
    -Xshare:on        require using shared class data, otherwise fail.
    The -X options are non-standard and subject to change without notice.
    
  • Hidden – Well as the name suggests, they are hidden. These options typically have a -XX prefix

To learn more about the HotSpot JVM options – http://java.sun.com/javase/technologies/hotspot/vmoptions.jsp

I found a great resource that lists various JVM versions and the corresponding options.
http://blogs.sun.com/watt/resource/jvm-options-list.html

Advertisements