Description: Modifies the launcher script to locate the JVM
 and the installation directory on a Debian system
Author: Emmanuel Bourg <ebourg@apache.org>
Forwarded: no
--- a/visualvm/launcher/visualvm
+++ b/visualvm/launcher/visualvm
@@ -44,6 +44,8 @@
 basedir=`pwd`
 cd "$old"
 
+basedir=/usr/share/visualvm
+
 case "`uname`" in
     Darwin*)
         # set default userdir and cachedir on Mac OS X
@@ -69,6 +71,20 @@
     . "$progdir"/../etc/visualvm.conf
 fi
 
+ARCH=`dpkg --print-architecture`
+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
+if [ -z "$visualvm_jdkhome" ]; then
+    echo >&2 "No jdkhome found"
+    exit 1
+fi
+
+. /etc/visualvm/visualvm.conf
 
 export DEFAULT_USERDIR_ROOT
 
