Reputation: 16238
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?
Upvotes: 67
Views: 76432
Reputation: 341
It seems the supporting bundle got removed upon update. https://discussions.apple.com/thread/4474992?start=0&tstart=0
Download the bundle to use as a workaround. https://visualvm.github.io/download.html
Upvotes: 29
Reputation: 12582
For JDK 9+ users
Starting with JDK 9, Visual VM will not be included with Oracle JDK. Developers who would like to use Visual VM with Oracle JDK 9 or later can get it from the Visual VM open source project site.
Upvotes: 15
Reputation: 1064
I downloaded the visualvm (.dmg from java.net) and that works for me on my Mountain Lion.
Upvotes: 22
Reputation: 3483
The Visual VM binary path for JDK 1.8 in macOS Mojave is
/Library/Java/JavaVirtualMachines/jdk1.8.0_231.jdk/Contents/Home/bin/jvisualvm
Basically,
/Library/Java/JavaVirtualMachines/<JDK_DIR>/Contents/Home/bin/jvisualvm
Upvotes: 2
Reputation: 179
VisualVM is also available as a standalone application. you can install it from https://visualvm.github.io/download.html
Upvotes: 3
Reputation: 7
Sometimes it is very simple... you need to install visualvm via
sudo apt-get install visualvm
For locating the files, use
dpkg -L visualvm
Upvotes: -3
Reputation: 205865
If you are already using NetBeans, another workaround is to use its profiler. In version 7.3:
Start the Java application from the command line, desktop or javawebstart.
In NetBeans, choose Profile > Attach Profiler
.
Select Attach to: <external Application>
.
Specify the desired analysis options.
Click the Attach
button.
Choose the target application.
Upvotes: 3
Reputation: 457
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
Upvotes: 32
Reputation: 11
I can only run the .app version of JVisualVM on my mountain lion MBP
open /usr/share/java/Tools/Java\ VisualVM.app
Upvotes: 1