HADOOP-6605. Add JAVA_HOME detection to hadoop-config. Contributed by Eli Collins

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1135333 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Eli Collins 2011-06-13 22:45:34 +00:00
parent b1b631516e
commit 667c400245
2 changed files with 19 additions and 9 deletions

View File

@ -215,6 +215,8 @@ Trunk (unreleased changes)
HADOOP-7106. Reorganize project SVN layout to "unsplit" the projects. HADOOP-7106. Reorganize project SVN layout to "unsplit" the projects.
(todd, nigel) (todd, nigel)
HADOOP-6605. Add JAVA_HOME detection to hadoop-config. (eli)
OPTIMIZATIONS OPTIMIZATIONS
HADOOP-7333. Performance improvement in PureJavaCrc32. (Eric Caspole HADOOP-7333. Performance improvement in PureJavaCrc32. (Eric Caspole

View File

@ -107,18 +107,26 @@ fi
# we use in Hadoop. Tune the variable down to prevent vmem explosion. # we use in Hadoop. Tune the variable down to prevent vmem explosion.
export MALLOC_ARENA_MAX=${MALLOC_ARENA_MAX:-4} export MALLOC_ARENA_MAX=${MALLOC_ARENA_MAX:-4}
# some Java parameters # Attempt to set JAVA_HOME if it is not set
if [ "$JAVA_HOME" != "" ]; then if [[ -z $JAVA_HOME ]]; then
#echo "run java in $JAVA_HOME" # On OSX use java_home (or /Library for older versions)
JAVA_HOME=$JAVA_HOME if [ "Darwin" == "$(uname -s)" ]; then
fi if [ -x /usr/libexec/java_home ]; then
export JAVA_HOME=($(/usr/libexec/java_home))
else
export JAVA_HOME=(/Library/Java/Home)
fi
fi
if [ "$JAVA_HOME" = "" ]; then # Bail if we did not detect it
echo "Error: JAVA_HOME is not set." if [[ -z $JAVA_HOME ]]; then
exit 1 echo "Error: JAVA_HOME is not set and could not be found." 1>&2
exit 1
fi
fi fi
JAVA=$JAVA_HOME/bin/java JAVA=$JAVA_HOME/bin/java
# some Java parameters
JAVA_HEAP_MAX=-Xmx1000m JAVA_HEAP_MAX=-Xmx1000m
# check envvars which might override default args # check envvars which might override default args