Java Tool Tutorials - Herong's Tutorial Notes
Dr. Herong Yang, Version 5.11

'jinfo' - VM Option Value Checker

This section provides a tutorial example on how to use the 'jinfo' tool to view the current value of a given HotSpot VM option.

The first JVM troubleshooting tool I want try is the "jinfo" tool.

The "jinfo" tool included in the Windows version of JDK 1.6 only supports functions to view and modify HotSpot VM options of the specified JVM process. Here is the "jinfo" command syntax:

C:\herong>\Progra~1\java\jdk1.6.0_02\bin\jinfo

Usage:
    jinfo <option> <pid>
       (to connect to a running process)

where <option> is one of:
    -flag <name>         to print the value of the named VM option
    -flag [+|-]<name>    to enable or disable the named VM option
    -flag <name>=<value> to set the named VM option to the given value
    -h | -help           to print this help message

HotSpot VM supports many options as described on the "Java HotSpot VM Options" page. You can change the default value of any HotSpot VM option using the "-XX:..." command option when running the "java" command.

Here is a tutorial example of how to use the "jinfo" tool get the current value of a given VM option:

C:\herong>\Progra~1\java\jdk1.6.0_02\bin\java 
   -jar "\Program Files\java\jdk1.6.0_02\demo\jfc\Notepad\notepad.jar"
   (Notepad started.)

   
(Start another command window.)
C:\herong>\Progra~1\java\jdk1.6.0_02\bin\jps -l -m

424 \Program Files\java\jdk1.6.0_02\demo\jfc\Notepad\notepad.jar
3984 sun.tools.jps.Jps -l -m


C:\herong>\Progra~1\java\jdk1.6.0_02\bin\jinfo 
   -flag ThreadStackSize 424

-XX:ThreadStackSize=0

Note that:

  • The "jps" tool is used to get the process ID (pid) of the Notepad JVM: 424.
  • The output of the "jinfo" command shows that the current value of the ThreadStackSize option is 0 in the Notepad JVM.

Sections in This Chapter

JVM Troubleshooting Tools in JDK 1.5

'jinfo' - VM Option Value Checker

Changing HotSpot VM Option using 'jinfo'

'jstack' - Stack Tracer of JVM Threads

Java Thread Deadlock Demo Program

Detecting Java Thread Deadlocks with 'jstack'

'jmap' - JVM Heap Dump Tool

Printing Histogram of Java Object Heap

Generating Heap Dump File with 'jmap'

'jhat' - Java Heap Analysis Tool

Starting 'jhat' Web Server on a Heap Dump File

Listing Instance Counts of All Classes

Browsing Object Instance Values

Object Query Language (OQL)

Searching for Instances with OQL Statements

Dr. Herong Yang, updated in 2008
'jinfo' - VM Option Value Checker