javavisualvmoraclejdk

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

Solution

  • visualvm checks the following three directories for a JDK:

    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