3

I would like to monitor a local Java application using JVisualVM. When I'm starting it, the popup 'Local java application cannot be monitored' or 'Local Applications Cannot Be Detected' is shown. I have read here that it is a permissions problem. Every time when I grant full access to folder %TMP%hsperfdata_MY_USER_ID to me (logged user) and everyone (windows user), the permissions are reset when I start JVisualVM.

I know that another solution is to delete hsperfdata_MY_USER_ID, but why does the permissions trick not work? Is the permissions folder reset a Windows feature?

System : Windows 7

Tested on cmd started as administrator. I use the same accounts and I do not pass any JVM parameters such as com.sun.management.jmxremote.port=XXXX.

Mark Jeronimus
  • 9,278
  • 3
  • 37
  • 50
Paweł Dulęba
  • 1,048
  • 1
  • 13
  • 25
  • which parameters do you pass to the JVM in order to enable monitoring by visualvm ? Are VisualVM and the application both run under the same account ? – Marged May 26 '15 at 09:51
  • Hi Marged, I use same account and I do not pass any parameter. Do you mean one of these _com.sun.management.jmxremote.port=XXXX_? – Paweł Dulęba May 27 '15 at 08:24
  • I moved your comment to the question body. How is the application being run? Is it being run as a service, or are you running it manually? – Necreaux May 28 '15 at 20:08
  • @PawełDulęba yes, I am talking about these. Try to specify them and do not run the program as a service (if you did before) – Marged May 29 '15 at 08:56
  • @Marged, Ok, I will check this. Thank you for suggestions! – Paweł Dulęba May 30 '15 at 07:59
  • Original 'here' link is dead, updated link: https://visualvm.github.io/troubleshooting.html#jpswin – Manuel Sep 12 '19 at 12:54

4 Answers4

5

For people stumbling here who have a FAT-type file system:

  • Make a directory (e.g. e:\temp) on an NTFS disk.
  • Start both java and jvisualvm with an environment variable TMP=E:\temp.

There are three options to set the environment variable for java:

  • In your IDE, go to the project options or launch options and find the 'Environment' entry, then enter TMP=E:\temp
  • Open a cmd prompt, and execute set TMP=E:\temp before launching youur java application from the same prompt.
  • Put the two lines you'd enter at the cmd prompt in a .bat file. Optinally add pause at the end of the bat file to prevent the console window from disappearing in case of a runtime exception or vm crash.

Similarly, for JVisualVM, use one of the last two options.

Mark Jeronimus
  • 9,278
  • 3
  • 37
  • 50
2

I had the 'Local Applications Cannot Be Monitored' problem, got it solved like this:

  1. Exit all java processes
  2. Delete existing folder %TMP%\hsperfdata_username
  3. Start jvisualvm, which created the folder with a different casing: %TMP%\hsperfdata_USERNAME

My problem and solution have nothing to do with permissions, so may not work for the original problem in the question.

Also see https://visualvm.github.io/troubleshooting.html#jpswin

Manuel
  • 649
  • 8
  • 13
0

This answer is a bit trivial but might still save time.

Check your java application is not lauched with the "-XX:-UsePerfData" option.

Pierre Vittet
  • 166
  • 1
  • 11
0

My username: A4000000

I had to delete C:\Users\A4000000\AppData\Local\Temp\hsperfdata_a4000000

AppData is a hidden folder.

Then once starting VisualVM again, it created the following:

 C:\Users\A4000000\AppData\Local\Temp\hsperfdata_A4000000

Notice the case difference.

Then start:

C:\visualvm_213\bin>  visualvm.exe --jdkhome "C:\Program Files\Java\jdk1.8.0_202" --userdir "C:\Temp\visualvm_userdir"
JCompetence
  • 6,997
  • 3
  • 19
  • 26