开发者

visualvm cannot see a java process launched from cygwin

开发者 https://www.devze.com 2023-03-19 18:27 出处:网络
If I start a java process in a cygwin console, and then launch visualVm, the later cannot see the former.

If I start a java process in a cygwin console, and then launch visualVm, the later cannot see the former.

If I start the same process in a Dos console visualvm sees it f开发者_如何学JAVAine. I am in jdk1.6.0_25. This happens both in win7 32b, and in win7 64b with a 64b jvm.

Anyone can think of an explanation/workaround?


I fixed the problem by running VisualVM from within Cygwin. If you prefer not to profile using a remote JMX connection, you can run both VisualVM and your Java program using Cygwin:

Open the Cygwin Console window, navigate to visual_vm.exe and run that file from within the Cygwin environment.


I had the same problem. The vm was not shown automatically but I was able to connect via "Add JMX Connection", using hostname and jmx.remote.port...

On VisualVM go to File -> Add JMX Connection

localhost:3333

Add vm parameter at startup e.g.:

 -Dcom.sun.management.jmxremote.port=3333
 -Dcom.sun.management.jmxremote.ssl=false
 -Dcom.sun.management.jmxremote.authenticate=false


VisualVM can automatically detect local applications running under the same user. So one explanation can be that cygwin process is running under the different user. Make sure that both VisualVM and monitored application is running under JDK 6 update 25. JDK 6 update 25 has a fix for the following JDK bug #6938627, which can affect your case.


The opposite approach to @seanhodges answer is to launch the application to debug with a modified environment, pointing it back to your Windows User Temp directory

For example if you normally do:

    ./gradlew run

And say your TEMP directory on Windows (according to your User environment variables) is:

    T:\Temp

You can do one of these instead:

    TMP=T:\\Temp ./gradlew run

    TMP=/cygdrive/t/Temp ./gradlew run

(they both seem to work)

0

精彩评论

暂无评论...
验证码 换一张
取 消