[root@impalaa init.d]# service hadoop-hdfs-namenode start
Starting Hadoop namenode:[ OK ]
Error: JAVA_HOME is not set and could not be found.
[root@impalaa init.d]# vi /etc/default/hadoop
[root@impalaa init.d]# service hadoop-hdfs-namenode start
Starting Hadoop namenode:[ OK ]
starting namenode, logging to /var/log/hadoop-hdfs/hadoop-hdfs-namenode-impalaa.out

修改/etc/default/hadoop文件,/etc/defalut里的文件都是各个项目的***-env.sh 文件。

比如/etc/default/hadoop就是hadoop项目的hadoop-env.sh文件

在此文件中增加export JAVA_HOME=/path/to/java就可以了