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 to try is the "jinfo" tool.

The "jinfo" tool supports functions to view and modify HotSpot VM options of the specified JVM process. Here is the "jinfo" command syntax:

C:\herong>jinfo

Usage:
    jinfo [option] <pid>
        (to connect to running process)
    jinfo [option] <executable <core>
        (to connect to a core file)
    jinfo [option] [server_id@]<remote server IP or hostname>
        (to connect to remote debug server)

where <option> is one of:
    -flag <name>         to print the value of the named VM flag
    -flag [+|-]<name>    to enable or disable the named VM flag
    -flag <name>=<value> to set the named VM flag to the given value
    -flags               to print VM flags
    -sysprops            to print Java system properties
    <no option>          to print both of the above
    -h | -help           to print this help message

HotSpot VM supports many options as described on the "Java HotSpot VM Options" Website at oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html. 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>java -XX:MaxHeapSize=123456789 PrimeNumberSeeker 10 200
Period, Current int, # primes
1, 2, 0
2, 10, 4
...

(Start another command window.)
C:\herong>jps -l -m
14084 PrimeNumberSeeker 10 200
10620 jdk.jcmd/sun.tools.jps.Jps -l -m

C:\herong>jinfo -flag MaxHeapSize 14084
-XX:MaxHeapSize=123731968

Note that:



 

Table of Contents

 About This Book

 Java Tools Terminology

 Java Tools Included in JDK

 javac - The Java Program Compiler

 jar - The JAR File Tool

 jlink - The JRE Linker

 jmod - The JMOD File Tool

 jimage - The JIMAGE File Tool

 java - The Java Program Launcher

 jdeps - The Java Class Dependency Analyzer

 jdeprscan - The Java Deprecated API Scanner

 jdb - The Java Debugger

 jcmd - The JVM Diagnostic Tool

 jconsole - Java Monitoring and Management Console

 jstat - JVM Statistics Monitoring Tool

JVM Troubleshooting Tools

 JVM Troubleshooting Tools in JDK

jinfo - VM Option Value Checker

 jinfo - Changing HotSpot VM Option

 jstack - Stack Tracer to Generate Thread Dump

 What Is a Thread Dump?

 Java Thread Deadlock Demo Program

 jstack - Detecting Java Thread Deadlocks

 jmap - JVM Heap Dump Tool

 Printing Histogram of Java Object Heap

 jmap - Generating Heap Dump File

 jhat - Java Heap Analysis Tool

 jhat - Starting 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

 jhsdb - The Java HotSpot Debugger

 jvisualvm (Java VisualVM) - JVM Visual Tool

 jmc - Java Mission Control

 javap - The Java Class File Disassembler

 keytool - Public Key Certificate Tool

 jarsigner - JAR File Signer

 jshell - Java Language Shell

 native2ascii - Native-to-ASCII Encoding Converter

 Outdated Tutorials

 References

 Full Version in PDF/EPUB