Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am running Mac OSX Snow Leopard.

I've always updated Java using the regular Software Update features of Mac OSX.

I've used the Java jvisualvm tool in the past with great success.

This morning I typed jvisualvm into the command line as I often do. I got the following error:

 $ jvisualvm
 Unable to locate an executable at "/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/jvisualvm" (-1)

All of the other Java tools (java, javac, jps, etc.) work just fine.

/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin indeed does not contain jvisualvm (all of a sudden).

/usr/libexec/java_home yields:

$ /usr/libexec/java_home
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home

WTF?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
659 views
Welcome To Ask or Share your Answers For Others

1 Answer

Seems like a mixup of links; the /usr/bin/jvisualvm symlink points to something that does not exist (as people pointed out above). Apparently the jvisualvm executable (stub) exists and the way to fix this for now is to execute:

cd /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin

sudo ln -s /System/Library/Java/Support/VisualVM.bundle/Contents/Home/bin/jvisualvm .

This requires sudo privileges and creates the missing symlink, pointing to the VisualVM bundle. No idea why it happened but upgrading to latest XCode 4.5.2 did not fix this for me automatically. I am running MacOS X 10.7.5 and java 1.6.0_37


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...