Repository: knox Updated Branches: refs/heads/master bc220dc1d -> ae03eb22b
KNOX-346: The knox-env.sh script should prefer JAVA_HOME over java on path Contributed by svelpula at hortonworks dot com (cherry picked from commit ba9097b9155425f4161bf98f10600d078e1f7858) Project: http://git-wip-us.apache.org/repos/asf/knox/repo Commit: http://git-wip-us.apache.org/repos/asf/knox/commit/ae03eb22 Tree: http://git-wip-us.apache.org/repos/asf/knox/tree/ae03eb22 Diff: http://git-wip-us.apache.org/repos/asf/knox/diff/ae03eb22 Branch: refs/heads/master Commit: ae03eb22ba64e239b7ed1072456148fcc052d57d Parents: bc220dc Author: Kevin Minder <kevin.min...@hortonworks.com> Authored: Mon Apr 7 18:02:25 2014 -0400 Committer: Kevin Minder <kevin.min...@hortonworks.com> Committed: Mon Apr 7 18:02:58 2014 -0400 ---------------------------------------------------------------------- gateway-release/home/bin/knox-env.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/knox/blob/ae03eb22/gateway-release/home/bin/knox-env.sh ---------------------------------------------------------------------- diff --git a/gateway-release/home/bin/knox-env.sh b/gateway-release/home/bin/knox-env.sh index 4fd2a70..fd860ac 100644 --- a/gateway-release/home/bin/knox-env.sh +++ b/gateway-release/home/bin/knox-env.sh @@ -26,15 +26,7 @@ function findJava() { JAVA="" fi fi - - # Try to find java on PATH. - if [ "$JAVA" == "" ]; then - JAVA=`which java 2>/dev/null` - if [ ! -x "$JAVA" ]; then - JAVA="" - fi - fi - + # Try to use JAVA_HOME to find java. if [ "$JAVA" == "" ]; then if [ "$JAVA_HOME" != "" ]; then @@ -45,6 +37,14 @@ function findJava() { fi fi + # Try to find java on PATH. + if [ "$JAVA" == "" ]; then + JAVA=`which java 2>/dev/null` + if [ ! -x "$JAVA" ]; then + JAVA="" + fi + fi + # Use the search patterns to find java. if [ "$JAVA" == "" ]; then for pattern in "${JAVA_VERSION_PATTERNS[@]}"; do @@ -58,4 +58,4 @@ function findJava() { fi } -findJava \ No newline at end of file +findJava