LinuxCommandLibrary

jinfo

Get configuration information for a Java process

SYNOPSIS

jinfo [options] <pid>
jinfo [options] <executable> <core>

PARAMETERS

-flags
    
Prints the VM flags (command-line arguments passed to the JVM). This includes both standard and non-standard options.

-sysprops
    
Prints the Java system properties for the target JVM. These are key-value pairs accessible via System.getProperty().

-F
    
Forces an operation on a hung or unresponsive Java process. Use with caution as it may have side effects.

-h, -help
    
Displays the command's help message and exits.

<pid>
    
The process ID of the target Java Virtual Machine.

<executable>
    
The Java executable from which the core dump was produced (used with <core>).

<core>
    
The core dump file of the Java process (used with <executable>).

DESCRIPTION

jinfo is a command-line utility provided with the Java Development Kit (JDK) designed for inspecting a running Java Virtual Machine (JVM). Its primary function is to print Java configuration information, including JVM system properties and command-line flags, for a specified Java process or a core file. This tool is invaluable for diagnosing issues, verifying runtime configurations, and understanding how a Java application is running without restarting it. It allows developers and administrators to quickly ascertain the active JVM arguments and properties that influence application behavior, memory settings, garbage collection, and more. jinfo provides a snapshot of the JVM's current configuration, aiding in troubleshooting and performance tuning efforts.

CAVEATS

jinfo requires appropriate permissions to attach to the target Java process, typically meaning the same user or root privileges. Attaching to a running JVM might momentarily pause the application, although this impact is generally minimal for jinfo compared to tools like jstack or jmap. It is exclusively for Java processes; attempting to use it on non-Java processes will result in an error.

FINDING THE PID

To use jinfo, you first need the Process ID (PID) of the target Java application. This can be obtained using the jps (Java Virtual Machine Process Status Tool) command, or standard Linux utilities like ps aux | grep java.

VM FLAGS VS. SYSTEM PROPERTIES

JVM flags are command-line arguments passed directly to the Java executable (e.g., -Xmx512m, -XX:+UseG1GC). They control the JVM's internal behavior and resource allocation. Java system properties are key-value pairs set either via -Dproperty=value on the command line or programmatically using System.setProperty(). They provide configuration information to the Java application itself.

HISTORY

The jinfo utility has been a staple diagnostic tool within the Java Development Kit (JDK) since JDK 5. Its purpose was to provide insights into a running JVM's configuration. However, with the evolution of the JDK and the introduction of more comprehensive tools, jinfo has been deprecated starting from JDK 11. Its functionality has been largely superseded and integrated into the more versatile jcmd command, which offers a broader range of diagnostic capabilities, and also accessible via jhsdb jinfo for attaching to processes and core dumps.

SEE ALSO

jps(1), jstack(1), jmap(1), jstat(1), jcmd(1), jhsdb(1)

Copied to clipboard