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>
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`