如果已经设置了hadoop-env.sh,如何修复未在Ubuntu上设置的JAVA_HOME?

时间:2013-01-02 17:00:16

标签: ubuntu hadoop java-home

我已将hadoop-env.sh设置为:

# export JAVA_HOME=/usr/lib/jvm/java-6-sun

但是当我启动hadoop时仍然有相同的错误:

Warning: $HADOOP_HOME is deprecated.

starting namenode, logging to /usr/local/hadoop/libexec/../logs/hadoop-hduser-namenode dyah-VirtualBox.out
localhost: starting datanode, logging to /usr/local/hadoop/libexec/../logs/hadoop-hduser-datanode-dyah-VirtualBox.out
localhost: Error: JAVA_HOME is not set.
localhost: starting secondarynamenode, logging to /usr/local/hadoop/libexec/../logs/hadoop-hduser-secondarynamenode-dyah-VirtualBox.out
localhost: Error: JAVA_HOME is not set.
starting jobtracker, logging to /usr/local/hadoop/libexec/../logs/hadoop-hduser-jobtracker-dyah-VirtualBox.out
localhost: starting tasktracker, logging to /usr/local/hadoop/libexec/../logs/hadoop-hduser-tasktracker-dyah-VirtualBox.out
localhost: Error: JAVA_HOME is not set.

当我输入echo $JAVA_HOME时,会显示:/usr/lib/jvm/java-6-sun。 当我键入java -version时,它会显示java的版本。

我已经将java的路径导出到/.bashrc

我不知道这里发生了什么,因为我已根据教程正确设置了这些内容。

2 个答案:

答案 0 :(得分:0)

导出语句由前导#注释掉,因此无效。

答案 1 :(得分:-2)

是否全局设置了环境变量,即它应该能够启动hadoop的用户。尝试(以root身份)手动导出JAVA_HOME,然后启动hadoop。