JVM Tools – JPS

JPS

The jps tool lists the instrumented HotSpot Java Virtual Machines (JVMs) on the target system. The tool is limited to reporting information on JVMs for which it has the access permissions.If jps is run without specifying a hostid, it will look for instrumented JVMs on the local host.

Usage:jps [ options ] [ hostid ]

The host identifier of the host for which the process report should be generated The general options include:

# q -Suppress the output of the class name, JAR file name, and arguments passed to the main method, producing only a list of local VM identifiers.
# m -Output the arguments passed to the main method. The output may be null for embedded JVMs.
# l -Output the full package name for the application’s main class or the full path name to the application’s JAR file.
# v -Output the arguments passed to the JVM.
# V -Output the arguments passed to the JVM through the flags file (the
.hotspotrc file or the file specified by the -XX:Flags=<filename> argument).
# Joption -Pass option to the java launcher called by javac. For example, -J-Xms48m sets the startup memory to 48 megabytes

Example:
First step is to get the process id of the Java application u sing Jps tool:

>jps
The tool will produce output like:
1335 startup.jar
1345 Jps

In this case startup.jar is the Java application of my interest so I will run the jmap tool against the process 1335.I will need to use -heap option to get the memory utilization snapshot:

image

image

Furthermore, if you are interested in seeing all the objects on the heap, with their sizes and with their counts that are reachable by the collector run the jmap tool with -histo (histogram) option:

image image

2 Comments

  1. Hi Joseph,

    can you please brief from where we can download the script files i.e., jps ,jmap all JVM tools.

    Thank you
    Sai

    Like

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.