Optionally support building and running with locally installed JDK

Change-Id: Ie08a4bf7952c0ed62dbc31dba0faa33eae9b133d
diff --git a/tools/package/onos-run-karaf b/tools/package/onos-run-karaf
index e898006..6fce6e8 100755
--- a/tools/package/onos-run-karaf
+++ b/tools/package/onos-run-karaf
@@ -5,6 +5,7 @@
 
 ONOS_TAR=
 JDK_TAR=
+ABSOLUTE_JAVABASE=
 
 [ -f $ONOS_TAR ] || (echo "$ONOS_TAR not found" && exit 1)
 
@@ -28,8 +29,11 @@
   *)        md5cmd='md5sum';;
 esac
 
-# Use provided JDK as JAVA_HOME if given
-if [[ -f ${JDK_TAR} ]]; then
+# Either use the given ABSOLUTE_JAVABASE as JAVA_HOME, or extract the passed
+# JDK_TAR and use that.
+if [[ -d ${ABSOLUTE_JAVABASE} ]]; then
+    export JAVA_HOME=${ABSOLUTE_JAVABASE}
+elif [[ -f ${JDK_TAR} ]]; then
     JDK_DIR=$ONOS_DIR-jdk
     JDK_MD5=$JDK_DIR/CHECKSUM