From e6415bab4f48c88f14a00fc55c10737589d20959 Mon Sep 17 00:00:00 2001 From: Stefano Mazzocchi Date: Fri, 24 Dec 2010 21:17:21 +0000 Subject: [PATCH] ISSUE-258 avoid ignoring the JAVA_HOME environment if java is not in the path git-svn-id: http://google-refine.googlecode.com/svn/trunk@1957 7d457c2a-affb-35e4-300a-418c747d4874 --- refine | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/refine b/refine index c19ae4822..4c4be0706 100755 --- a/refine +++ b/refine @@ -818,21 +818,19 @@ if [ "$OS" = "macosx" ] ; then fi fi -JAVA="`which java 2> /dev/null`" -if [ -z "$JAVA" ] ; then - if [ "$JAVA_HOME" ] ; then - JAVA="$JAVA_HOME/bin/java" - if [ ! -f "$JAVA" ] ; then - error "Could not find the 'java' executable at '$JAVA', are you sure your JAVA_HOME environment variable is pointing to a proper java installation?" - fi - else - error "The 'java' command should be in your path or the 'JAVA_HOME' environment variable should be set" - fi +if [ "$JAVA_HOME" ]; then + JAVA="$JAVA_HOME/bin/java" +else + JAVA="`which javas 2> /dev/null`" +fi + +if [ ! -x "$JAVA" ] ; then + error "Could not find the 'java' executable at '$JAVA', are you sure your JAVA_HOME environment variable is pointing to a proper java installation?" fi JAVA_VERSION=`$JAVA -version 2>&1 | grep version | cut -d ' ' -f 3 | egrep ^\"1\.6` if [ -z "$JAVA_VERSION" ] ; then - error "Google Refine requires Java version 6 or later. If you have multiple versions of Java installed, please set JAVA_HOME to the correct version." + error "Google Refine requires Java version 6 or later. If you have multiple versions of Java installed, please set the environment variable JAVA_HOME to the correct version." fi # ----- Parse the command line args ------------------------------------------