Modified the setting of JAVA_HOME for linux to be more generic. 10/2010/2
authorSam Hague <shague@redhat.com>
Fri, 18 Oct 2013 13:09:51 +0000 (09:09 -0400)
committerGerrit Code Review <gerrit@opendaylight.org>
Fri, 18 Oct 2013 19:17:48 +0000 (19:17 +0000)
The new code sets the value with the assumption that the user has java
somewhere in their path and that it is set to the JAVA version they
want to use. JAVA_HOME is then set based on that location.

Change-Id: Ie77f0c34f1c1d342ed0a8d0660631db7e5623137
Signed-off-by: Sam Hague <shague@redhat.com>
opendaylight/distribution/opendaylight/src/main/resources/run.sh

index 58ead435103c24fd27d99f8d8f541b6135611027..e4c20da350b87fac520cab4b9d2dac48881f1810 100755 (executable)
@@ -11,8 +11,14 @@ fi
 if [[ $platform == 'linux' ]]; then
    fullpath=`readlink -f $0`
 
-   [[ -z ${JAVA_HOME} ]] && [[ -x "/usr/lib/jvm/java-1.7.0" ]] && export JAVA_HOME='/usr/lib/jvm/java-1.7.0';
+   if [[ -z ${JAVA_HOME} ]]; then
+      # Find the actual location of the Java launcher:
+      java_launcher=`which java`
+      java_launcher=`readlink -f "${java_launcher}"`
 
+      # Compute the Java home from the location of the Java launcher:
+      export JAVA_HOME="${java_launcher%/bin/java}"
+    fi
 elif [[ $platform == 'osx' ]]; then
    TARGET_FILE=$0
    cd `dirname $TARGET_FILE`