Reputation: 113
I am trying to use jvmmonitor to profile my app in eclipse but there are no jvms listed, not even the running eclipse jvm and when I start my app the new jvm does not appear.
The docs say >
At least one JVM (Eclipse itself) should be shown on JVM Explorer. If no JVM is shown, it is likely that Eclipse is not started with supported JDK. For example, JRE might be used instead of JDK. To solve the issue, Check the value of system property java.home with Help > About Eclipse > Installation Details > Configuration. You may see that the supported JDK is not specified to java.home. Close Eclipse. To enforce using a desired JDK on Eclipse, specify the option -vm to the eclipse executable, or alternatively specify it in eclipse.ini. See the Workbench User Guide to learn how to specify that option. Start Eclipse.
The java.home property in the eclipse config says /home/myname/programs/jdk/jre
I have tried to change it but nothing will. my -vm is already set to the jdk directory and my linux .profile and .bashrc exports to the JAVA_HOME to the jdk directory but java.home in eclipse still says /home/myname/programs/jdk/jre
I have also set the jdk root directory to /home/myname/programs/jdk/ in the java>monitor>tools preferences page but still no luck.
I have uninstalled jvmmonitor and reinstalled it completely but there is no change.
I am running eclipse indigo with jdk 7 and jvmmonitor 3.8
This is driving me nuts now, any ideas would be most welcome
Thanks in advance
Upvotes: 3
Views: 5649
Reputation: 55
after try the first solution (change ini file) it not worked and I just but the jdk path in the preferences :
Upvotes: 0
Reputation: 2977
Did you check the directive in this JVMMonitor's FAQ?
If the problem persists, run Eclipse as an Administrator, at least once after the installation of JVM Monitor plugin.
This solved the problem for me.
Upvotes: 0
Reputation: 1971
You have to change the .ini file of Eclipse
Just add:
-vm C:\JavaJDK\Java\jdk1.6.0_01\jre\bin\client\jvm.dll
Here is the eclipse.ini file in full:
-startup
plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.200.v20090519
-product
org.eclipse.epp.package.jee.product
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
-vm
C:\JavaJDK\Java\jdk1.6.0_01\jre\bin\client\jvm.dll
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx512m
Upvotes: 2
Reputation: 13327
This solution from the JVisualVM Troubleshooting Guide also helps me for jvmmonitor:
Local Applications Cannot Be Monitored
Description: An error dialog saying that local applications cannot be monitored is shown immediately after VisualVM startup. Locally running Java applications are displayed as (pid ###).
Resolution: This can happen on Windows systems if the username contains capitalized letters. In this case, username is
UserName
but the jvmstat directory created by JDK is%TMP%\hsperfdata_username
. To workaround the problem, exit all Java applications, delete the%TMP%\hsperfdata_username
directory and create new%TMP%\hsperfdata_UserName
directory.
Upvotes: 1
Reputation: 113
I have found the solution after hours of fiddling. I am using VisualJVM now instead but they operate in the same way by connecting to a local socket and setting up a JMX connection.
Firstly Both jvmmonitor/visualjm and your java app MUST be running under the same user.
The user must have write access to the tmp directry on linux /tmp/.
When any java app is launched a local file with the process PID for the java program is created in hsperfdata_myusername folder in tmp which is used by java profiling software to connect to the jvm running your java program.
If you launch a java program from a terminal and the current directory of the terminal is not your home directory, eg. launching from MYNAME:/home/myname/project/myjavaapp$ you may find that you can connect to the jvm but not be able to sample or profile it. Making the current directory your home directory should solve this problem.
Upvotes: 2