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

Advertisements

2 thoughts on “JVM Tools – JPS

  1. Sai Raghavendar V says:

    Hi Joseph,

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

    Thank you
    Sai

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s