21

I tried to run JConsole to analyze the memory used by a running process, but JConsole doesn't show me processes even though I am absolutely sure that one is running (in addition to that it should show JConsole in the process list as well but it doesn't).

Does anyone have an idea why it doesn't show any processes?

Cheers

user1765902
  • 281
  • 1
  • 3
  • 8

8 Answers8

17

at window prompt, run echo %TMP%, it will give you default temp dir. Go to that directory and find directory named hsperfdata_user where user is your login. This is directory to store your process id. Any new process you created such as java application will have a new file named by process id. Jconsole will pick up the process ids from this directory. If you cannot create a file in this directory, that means you need change permission to allow write. Once done that, start a new java application to see if new process id file is in the dir. Once confirmed, start jconsole

geert3
  • 7,086
  • 1
  • 33
  • 49
james liao
  • 179
  • 1
  • 3
14

I have the same problem. But if I explicitly specify the PID, as in jconsole 1234, jconsole is able to analyze the process.

Steve Westbrook
  • 1,698
  • 2
  • 20
  • 21
user2195918
  • 181
  • 1
  • 6
  • 2
    Can you provide more details on how you do this? – Steve Westbrook Mar 21 '13 at 16:18
  • @SteveWestbrook, Open a terminal, and instead of running "jconsole", run "jconsole 1234" where 1234 is the PID of your Java process. Now as to how to find the PID of your Java process, you can do it via Task Manager in Windows or by running "ps ax" in Linux.. – Anu Shibin Joseph Raj Feb 22 '21 at 01:01
9

If you are running jconsole on windows - simply :

  1. Find jconsole.exe
  2. Right click it
  3. Select run as administrator.
Imene Noomene
  • 3,035
  • 5
  • 18
  • 34
RoyalBigMack
  • 620
  • 7
  • 7
3

In my case, removal of hsperfdata_USERNAME directory (in %TMP% directory) and closing all the JVMs has helped.

Łukasz K
  • 562
  • 6
  • 10
1

This happens when %TMP% value is different for monitored JVM and the monitoring tool (JConsole/JMC/Java Mission Control, maybe even VisualVM). This may be the standard scenario with Cygwin (at least in my case: Cygwin+Babun) Easiest solution is to set value of the TMP environment variable to the default value used by Windows, at least in scope of shell launching the JVM.

patrikbeno
  • 1,114
  • 9
  • 23
1

You have to start jconsole with the same user as the process you want to analyze is started by.

mibutec
  • 2,929
  • 6
  • 27
  • 39
1

Just ran into this issue

If you are using multiple jdk's by any chance (ex. SDKMAN), then make sure that jconsole is run using the same jdk as the application

jrhee17
  • 1,152
  • 9
  • 19
1

8 years later... I had the same problem. I could only see certain processes but couldn't see and monitor any java processes running in a docker container in Linux.

Inspired by the Windows solution by RoyalBigMack:

  • Solution 1. Run terminal as super user (su command) and run jconsole
  • Solution 2. Run solution 1 as one command, sudo jconsole

Only the first solution worked for me, and once the jconsole UI popped up- all the hidden processes were now visible.

Dharman
  • 30,962
  • 25
  • 85
  • 135
dko
  • 197
  • 8