Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

visualvm fails with "No jdkhome found" on Ubuntu 15.10 with Oracle JDK

I installed Oracle JDK from the webupd8team/java PPA, and then installed the visualvm package. When starting visualvm, I get the following error message:

[beni:~]$ visualvm
No jdkhome found

My $JAVA_HOME is set correctly to /usr/lib/jvm/java-7-oracle.

Also, when starting visualvm with the jdkhome property set, I get the same error:

[beni:~]$ visualvm --jdkhome $JAVA_HOME
No jdkhome found
like image 344
Benedikt Köppel Avatar asked Jan 02 '16 13:01

Benedikt Köppel


1 Answers

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
like image 181
Benedikt Köppel Avatar answered Sep 18 '22 19:09

Benedikt Köppel