Java 1.6

Setup

Using JMX with Java 1.6 is very simple.

If you are monitoring an application running locally, then simply start it using the Java 1.6 JVM…

If you are monitoring a remote application, it will need to be started with the following parameters:

-Dcom.sun.management.jmxremote.port=1098
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false

Run JConsole which you can find in the JDK bin folder.

On my workstation it can be found in:

C:\tools\jdk1.6.0\bin\jconsole.exe

You should be able to attach to local processes and monitor them… for remote processes specify the server name and port (the port in the example above is 1098).

JConsole - Remote Connection:

../../images/howto/jmx/jconsole-remote-connection.gif

Issues

Connection

If you find that JConsole cannot see the process you are trying to monitor:

put briefly the answer is: set the tmp variable to c:temp for the process calling the application as well as the process calling the monitoring tool.

set TMP=c:\temp\
\tools\jdk1.6.0\bin\jconsole.exe
set TMP=c:\temp\
java -cp ....

20/03/2007 08:56

Trying to be clever, I set the Windows environment variable TMP to c:\\temp\ and JConsole could no longer see the process.

To solve the problem I removed TMP and TEMP from the User variables… and left them set at the default for System variables (which is C:\\WINDOWS\\TEMP).

Java 1.6

You will have to make sure your project is built using Java 1.6… so don’t forget to do a clean if you cannot attach to the process.

jps - Java Virtual Machine Process Status Tool

Java - Process, ../javaprocess.