5euaaa
Last Updated: February 25, 2016
·
8.582K
· purak
Fe0a1519fcf6d2efd7f1a0bbc20660d2

Run VisualVM on Ubuntu with Oracle JVM

Last night, I installed VisualVM for monitoring Cassandra. But that tool did not work on my box.

I returned the following error:

No jdkhome found

So the fix that, I opened /usr/bin/jvisualvm script. I realized the problem immediatelly. The script contains the following lines:

jdkhome=
for j in /usr/lib/jvm/java-7-openjdk-$ARCH /usr/lib/jvm/java-6-openjdk-$ARCH; do
    if [ -x $j/bin/javac ]; then
        jdkhome=$j
        break
    fi
done
if [ -z "$jdkhome" ]; then
    echo >&2 "No jdkhome found"
    exit 1
fi

The package built for running on OpenJDK but I am using Oracle Java!

I added the following to second line of the above code:

/usr/lib/jvm/java-7-oracle

But now, I get the following warning and the program does not work.

Cannot find java. Please use the --jdkhome switch.

Meeh, That's a fucking Java tool. Unfortunately, the package was tuned for running on OpenJDK. So I am using an alias to bypass the problem.

alias jvisualvm='jvisualvm --jdkhome /usr/lib/jvm/java-7-oracle'

And edit the desktop launcher, open /usr/share/applications/visualvm.desktop and add --jdkhome switch.

Exec=/usr/bin/jvisualvm --jdkhome /usr/lib/jvm/java-7-oracle

It runs for now...

Say Thanks
Respond
Filed Under