Table of Contents

About

JConsole is a JMX client (ie Its' as jmx graphical tool for monitoring a Java virtual machine)

Its full name is Java Monitoring and Management Console.

It:

  • is included with the Java SE platform (version 5 onwards).
  • provides information about the performance and resource consumption of applications that are running on the Java platform.

Example

A snapshot of Jconsole Memory where we can see the garbage collector reducing the heap memory periodically.

Jconsole Memory Tab

Step by Step

Open Jconsole

JConsole resides in the 'bin' (binaries) folder under the JDK Java directory.

To call Jsonsole, the path is:

JDK_HOME/bin/jconsole.exe

where JDK_HOME is the path to the JDK directory

Example:

where java
C:\Program Files\Microsoft\jdk-11.0.12.7-hotspot\bin\java.exe

"C:\Program Files\Microsoft\jdk-11.0.12.7-hotspot\bin\jconsole.exe"

Make a connection

You will be prompted to create a new connection.

JConsole, or any JMX client, will not see applications that are not owned by the same user.

For example under Windows, if an application is started as a service, it is the System User who owns the process, and not the Current User.

Local

You just need to pick the Java process that you want to monitor

Remote

To be able to connect remotely, you need to enable JmxRemote by adding the jmxremote parameters to the execution of your java application.

Example:

java
-Dcom.sun.management.jmxremote \
-Dcom.sun.management.jmxremote.port=9010 \ # port is mandatory as there is no default
-Dcom.sun.management.jmxremote.local.only=false \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.ssl=false \
-Djava.rmi.server.hostname=hostname \ # optional default to the os hostname
....

If your application is JmxRemote enabled, you connect by entering:

  • the hostname where your application is running
  • the JMX remote port

Plugin

See:

 JDK_HOME/bin/jconsole -pluginpath JDK_HOME/demo/management/JTop/JTop.jar

Documentation