Monday, January 28, 2008

Making jps and jconsole Work with Java SE 6 on Windows Vista

I recently discovered that the JConsole tool stopped automatically detecting local processes in the JVM in which it was running. I knew that, at the very least, it should show itself in the connection window. The issue was resolved based on the useful information provided by Luis-Miguel Alventosa in the SDN JMX forum thread Cannot see local process list in JConsole in of JDK 6. This blog entry summarizes the recommended steps and displays how the problem was fixed. Note that another forum entry that references the forum entry linked to above is JMX - jconsole connects to local vm only if given PID.

The problem with JConsole was tied to jps as well. This was especially problematic because I could always use JConsole to connect to a particular PID, but I wanted to use jps to help me find that PID. I blogged about the usefulness of jps in this blog entry.

I followed the instructions in the JMX - Cannot see local process list in JConsole of JDK 6. My first screen shot shows the results of running jps. Note that there is no PID shown even though at least jps itself should be shown.

The next screen shot shows that JConsole cannot find any local instrumented Java applications even though it should, at the very least, find itself.

As the above screen shot (two above) demonstrates, I used the echo %TMP% command to determine what the TMP environment variable was set to. I navigated to that directory and went into the hsperfdata_Dustin folder (shown in the next screen shot).

I don't show it here, but I went into the Vista properties for the hsperfdata_Dustin directory and enabled permissions on that directory (they were ALL off). The next two screen shots demonstrate that JConsole and jps now worked for me again.

JConsole and jps weren't working simply because Vista wasn't letting me change files in that %TMP%/hsperfdata_Dustin directory. Once I opened up permissions on that directory, both jps and jconsole worked as expected.

UPDATE (25 November 2008): The blog entry JMX Examples Don't Work Under Windows discusses how the characters used in the TMP environment variable can adversely affect the ability of JConsole to "see" managed applications.


Paul Vincent Craven said...

Thanks, this is just what I was looking for today.

@DustinMarx said...


I am glad this was useful for you. Thanks for letting me know if was helpful. I appreciate the feedback.


Mario said...

Thanks a lot, this really helped me

Mario - Lima - Peru