hadoop2 JAVA_HOME is not set and could not be found

启动yarn的报错JAVA_HOME not set的处理办法

问题: JAVA_HOME is not set

解决办法:

添加两处:

1.$HADOOP_HOME/etc/hadoop/yarn-env.sh 

中添加:

--------------------------------上面添加------

export JAVA_HOME=/usr/java/jdk1.7.0_55 

if [ "$JAVA_HOME" != "" ]; then
  #echo "run java in $JAVA_HOME"
  JAVA_HOME=$JAVA_HOME
fi
  
if [ "$JAVA_HOME" = "" ]; then
  echo "Error: JAVA_HOME is not set."
  exit 1
fi

--------------------------------------------------------------------

export JAVA_HOME=/usr/java/jdk1.7.0_55   (根据自己jdk 的路径来设置)

 


2. $HADOOP_HOME/libexec/hadoop-config.sh

 ----------------------------下面添加:

# Newer versions of glibc use an arena memory allocator that causes virtual
# memory usage to explode. This interacts badly with the many threads that
# we use in Hadoop. Tune the variable down to prevent vmem explosion.


export JAVA_HOME=/usr/java/jdk1.7.0_55


----------------------------------------------------

 

你可能感兴趣的:(hadoop)