From b6a18a17d90aa761602d53c6f20c16920557553e Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Tue, 29 Dec 2009 23:08:20 +0000 Subject: [PATCH] HBASE-2074 Improvements to the hadoop-config script git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@894505 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 1 + bin/hbase-config.sh | 34 +++++++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index 8eaf6d12b2c..f163c722e61 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -257,6 +257,7 @@ Release 0.21.0 - Unreleased times HBASE-2062 Metrics documentation outdated (Lars George via JD) HBASE-2045 Update trunk and branch zk to just-release 3.2.2. + HBASE-2074 Improvements to the hadoop-config script NEW FEATURES HBASE-1901 "General" partitioner for "hbase-48" bulk (behind the api, write diff --git a/bin/hbase-config.sh b/bin/hbase-config.sh index fad8039d109..103f8e93409 100644 --- a/bin/hbase-config.sh +++ b/bin/hbase-config.sh @@ -44,7 +44,9 @@ bin=`cd "$bin"; pwd` this="$bin/$script" # the root of the hbase installation -export HBASE_HOME=`dirname "$this"`/.. +if [ -z "$HBASE_HOME" ]; then + export HBASE_HOME=`dirname "$this"`/.. +fi #check to see if the conf dir or hbase home are given as an optional arguments while [ $# -gt 1 ] @@ -71,3 +73,33 @@ done HBASE_CONF_DIR="${HBASE_CONF_DIR:-$HBASE_HOME/conf}" # List of hbase regions servers. HBASE_REGIONSERVERS="${HBASE_REGIONSERVERS:-$HBASE_CONF_DIR/regionservers}" + +if [ -z "$JAVA_HOME" ]; then + for candidate in \ + /usr/lib/jvm/java-6-sun \ + /usr/lib/j2sdk1.6-sun \ + /usr/java/jdk1.6* \ + /usr/java/jre1.6* \ + /Library/Java/Home ; do + if [ -e $candidate/bin/java ]; then + export JAVA_HOME=$candidate + break + fi + done + # if we didn't set it + if [ -z "$JAVA_HOME" ]; then + cat 1>&2 < http://java.sun.com/javase/downloads/ < | +| | +| HBase requires Java 1.6 or later. | +| NOTE: This script will find Sun Java whether you install using the | +| binary or the RPM based installer. | ++======================================================================+ +EOF + exit 1 + fi +fi