visualvm fails with “No jdkhome found” on Ubuntu 15.10 with Oracle JDK

只愿长相守 提交于 2019-12-04 22:51:12
Benedikt Köppel

visualvm checks the following three directories for a JDK:

  • /usr/lib/jvm/java-7-openjdk-$ARCH
  • /usr/lib/jvm/java-8-openjdk-$ARCH and
  • /usr/lib/jvm/default-java

From the /usr/bin/visualvm start script:

visualvm_jdkhome=
for j in /usr/lib/jvm/java-7-openjdk-$ARCH /usr/lib/jvm/java-8-openjdk-$ARCH /usr/lib/jvm/default-java; do
    if [ -x $j/bin/javac ]; then
       visualvm_jdkhome=$j
       break
    fi
done

So make /usr/lib/jvm/default-java a symlink to $JAVA_HOME, and visualvm will find the right JDK.

cd /usr/lib/jvm
sudo ln -Tsf java-7-oracle default-java

In my case even the symlink of default-java didn't fixed the problem. To fix, I did:

Edited jvisualvm and add any "trash" into jdkhome variable

  • $ sudo vi /usr/bin/jvisualvm

jdkhome=/tmp

Then started the program passing parameter:

  • /usr/bin/jvisualvm --jdkhome /usr/lib/jvm/myJava7

Note: today (2016), with my version is working only with java7

Update:now, in 2017, using version 1.3.8, it's working with Java 8. But I needed to add visualvm_jdkhome=/tmp, in /usr/bin/visualvm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!