From 7b9ef3f7a0aed56c2394a0757d6c7871b898bdd9 Mon Sep 17 00:00:00 2001 From: Sam Hague Date: Fri, 18 Oct 2013 09:09:51 -0400 Subject: [PATCH] Modified the setting of JAVA_HOME for linux to be more generic. 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 --- .../distribution/opendaylight/src/main/resources/run.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/opendaylight/distribution/opendaylight/src/main/resources/run.sh b/opendaylight/distribution/opendaylight/src/main/resources/run.sh index 58ead43510..e4c20da350 100755 --- a/opendaylight/distribution/opendaylight/src/main/resources/run.sh +++ b/opendaylight/distribution/opendaylight/src/main/resources/run.sh @@ -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` -- 2.36.6