I have a Java application, and I'd like to monitor it using Java VisualVM (jvisualvm
).
However, in the VisualVM window very little data can be seen. Also, I can't take a heap dump.
Here is a screenshot of what it looks like, with another test app I wrote:
I can monitor memory usage, classes loaded and threads. Heap dumps, performing GC as well as sampling is disabled.
I have tried adding -Dcom.sun.management.jxmremote
to VM arguments, as described here. This is showing up in the Installation Details window. However, it does not appear in the Java process arguments. (should it?)
I also tried to click the button in my test app until an OutOfMemoryError
occurred. No heap dump; that is not weird as Heap Dump on OOME is disabled.
What could I do to solve this?
It seems there was a problem with different Java versions.
A long story short: If JDK is outdated re-install it, and delete Java executables from
C:\Windows\System32
andC:\Windows\SysWOW64
.Firstly, I want to tell you that I have multiple versions of Java on my computer. My JDK is 32-bit because of some drivers not running with 64-bit Java. Also, I have both 32-bit and 64-bit JRE installed, the latter for better performance for Java games.
My JDK was version 7, update 40. The VisualVM was so also that version. However, my JRE with auto updates was version 7, update 45.
java -version
told me it was version 45 (which it was), so I didn't think the problem was there.Then, I checked the versions via Control Panel. I now knew my JDK was outdated, so I uninstalled it and redownloaded it.
Uninstalling removed Java from the system path, so
jvisualvm
wouldn't run. I added it to the path. Now both the app and VisualVM ran normally, but still the problem persisted.The final problem was that the system was using the
java.exe
fromC:\Windows\System32
instead of the JDK one. By the date it seemed to be the latest one, but maybe it was that the JRE was installed in a different location that the VisualVM (= the JDK).Finally, I just deleted the Java executables in both
C:\Windows\System32
andC:\Windows\SysWOW64
.