Mac安装VisualVM 2.2启动闪退
VisualVM 2.2 在 Mac 上的安装配置步骤如下:
- 下载 VisualVM
从官网(https://visualvm.github.io/download.html)下载最新版本(截至 2025 年 10 月,最新版本为2.2)。 - 双击安装后,点击启动闪退,报错信息如下:
/Applications/VisualVM.app/Contents/MacOS/visualvm ; exit;
rcm@rcmdeMacBook-Pro ~ % /Applications/VisualVM.app/Contents/MacOS/visualvm ; exit;
The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.Cannot find java. Please use the --jdkhome switch.Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.- 解决方案:修改 JDK 路径
打开应用内的 visualvm.conf 配置文件(路径:/Applications/VisualVM.app/Contents/Resources/visualvm/etc/),在文件末尾添加以下内容:
visualvm_jdkhome="/opt/homebrew/opt/openjdk@21/libexec/openjdk.jdk/Contents/Home"(更换为你自己的java_home)
