Skip to content

Latest commit

 

History

History
50 lines (29 loc) · 2 KB

jconsole.md

File metadata and controls

50 lines (29 loc) · 2 KB

Using JConsole to connect to an application via JMX

NOTE: The shell commands are for a *nix operating system (Linux, *BSD, etc...). The GUI steps should be the same for all operating systems.

Installation

The jconsole application is included with any JDK (Java Development Kit). If you have the JAVA_HOME environment variable set, you can verify this with:

ls -la $JAVA_HOME/bin/jconsole

Otherwise, you can verify with:

which jconsole

If you don't have a JDK installed, there usually exist instructions for your operating system to install a JDK. Installing a JRE (Java Runtime Environment) is not enough, as it doesn't include jconsole.

Connect to application via JMX

First, start JConsole by running the binary:

jconsole

This will bring up the initial jconsole window:

Screenshot of the window shown when jconsole initially starts.  A panel titled "JConsole: New Connection" is shown.

Click into the "Remote Process" field and enter the address of your JMX port, in our case localhost:9010. Since we have not setup any authentication, we don't need to enter a username or password. Then click the "Connect" button to start the connection.

Screenshot of entering the remote address in the JConsole New Connection panel.

JConsole will warn you about the insecure connection. Just click the "Insecure connection" button to proceed.

Screenshot of the insecure connection warning dialog, with two buttons, "Cancel" and "Insecure connection".

Finally, at this point JConsole will start reading JVM metrics over JMX. On the main screen you can see memory, threads, classes, and CPU usage:

Screenshot of the default graphs shown by jconsole after connecting to a running JVM process, including memory, threads, classes, and CPU usage.

Links