localhost: Error: JAVA_HOME is not set.
在namenode启动脚本%Hadoop_HOME%/bin/start-dfs.sh的时候发现datanode报错:
Error: JAVA_HOME is not set
原因是在%HADOOP_HOME%/conf/hadoop-env.sh内缺少JAVA_HOME的定义,只需要在hadoop-env.sh中增加:
JAVA_HOME=/your/jdk/root/path
即可
Hadoop 启动服务的时候报如下错误
:
[root@localhost hadoop-0.20.2]# start-all.sh
This script is Deprecated. Instead use start-dfs.sh and start-mapred.sh
starting namenode, logging to /home/chenwq/hadoop/hadoop-0.21.0/bin/../logs/hadoop-root-namenode-ubuntu.out
localhost: Error: JAVA_HOME is not set.
localhost: Error: JAVA_HOME is not set.
starting jobtracker, logging to /home/chenwq/hadoop/hadoop-0.21.0/bin/../logs/hadoop-root-jobtracker-ubuntu.out
localhost: Error: JAVA_HOME is not set.
解决方法:
编辑 conf/hadoop-env.sh
把 JAVA_HOME 设置为 java 安装的根路径
JAVA_HOME=/home/jdk/jdk1.6.0_16 # 这里需要根据自己的安装路径来写