JMX - JConsole (Client)

> Procedural Languages > Java > Java - Java Management eXtensions (JMX)

1 - About

A JMX-compliant graphical tool for monitoring a Java virtual machine. It can monitor both local and remote JVMs. It can also monitor and manage an application.

JConsole is a readily available JMX client that is included with the Java SE platform (version 5 onwards). It's a monitoring and management tool, which complies with the JMX specification.

JConsole uses the extensive instrumentation of the Java VM (the platform MXBeans) to provide information about the performance and resource consumption of applications that are running on the Java platform.

The full name is the 'Java Monitoring and Management Console'.

Remote monitoring is recommended to isolate the JConsole application from the platform being monitored.

Advertising

3 - Management

3.1 - Adding the JMX Client to your Path

You must add the location of the JConsole binary file to your 'path' environment variable. As JConsole resides in the 'bin' (binaries) folder under your Java directory, the path should resemble something like this:

JDK_HOME/bin/jconsole.exe

In this example, replace 'JDK_HOME' with the full system path to your Java directory.

3.2 - Configuring JConsole

To configure JConsole,

  • Run the JConsole application.
  • You will be prompted to create a new connection. Choose 'remote process', enter the hostname of your application and a port of your choosing.

To connect easily, add the startup parameters to setenv.bat or setenv.sh:

-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8086 
-Dcom.sun.management.jmxremote.authenticate=false

Port 8086 is unlikely to be used. Then, connect remotely using port 8086.

JConsole, or any JMX client, will not see applications which are not owned by the same user. For example under Windows, if an application is started as a service, it is the System User which owns the process, and not the Current User.

  • Click 'Connect'.

Other JMX clients besides JConsole can read JMX information

Advertising

3.3 - Plugin

See:

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

4 - Documentation