I had the same issue on Ubuntu 10.04, and although the launch script is written 
differently -- the word "sun" does not appear in the 10.04 launch script -- the 
symptom was the same.  Attempting to run jvisualvm caused:
[[
$ jvisualvm
Cannot find java. Please use the --jdkhome switch.
]]

The problem seems to be that jvisualvm is a symbolic link into the openjdk 
directory instead of the Sun JDK directory:
[[
$ which jvisualvm
/usr/bin/jvisualvm
$ ls -l /usr/bin/jvisualvm 
lrwxrwxrwx 1 root root 39 2010-11-27 13:08 /usr/bin/jvisualvm -> 
../lib/jvm/java-6-openjdk/bin/jvisualvm
$ ls -l /usr/lib/jvm/java-6-openjdk/bin/jvisualvm
-rwxr-xr-x 1 root root 2749 2010-05-03 04:31 
/usr/lib/jvm/java-6-openjdk/bin/jvisualvm
]]

However, I do have the Sun jdk properly installed:
[[
$ which java
/usr/bin/java
$ ls -l /usr/bin/java
lrwxrwxrwx 1 root root 22 2010-11-23 08:58 /usr/bin/java -> 
/etc/alternatives/java
$ ls -l /etc/alternatives/java
lrwxrwxrwx 1 root root 36 2010-11-23 08:58 /etc/alternatives/java -> 
/usr/lib/jvm/java-6-sun/jre/bin/java
$ ls -l /usr/lib/jvm/java-6-sun/jre/bin/java
-rwxr-xr-x 1 root root 47308 2010-09-15 04:41 
/usr/lib/jvm/java-6-sun/jre/bin/java
$ java -version
java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) Server VM (build 17.1-b03, mixed mode)
]]

My workaround was to explicitly use the --jdkhome option to explicitly
specify the Sun JDK directory every time I run jvisualvm:

  $ jvisualvm --jdkhome /usr/lib/jvm/java-6-sun/

That made VisualVM work.

-- 
visualvm fails to launch because it can't find jdk
https://bugs.launchpad.net/bugs/657048
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to