我已经安装了hadoop,我已经设置了JAVA_HOME,但仍然出现此错误,为什么?
/opt/hadoop/2.5.1/sbin: $JAVA_HOME
-bash: /opt/java/6.0: Is a directory
/opt/hadoop/2.5.1/sbin: ./start-dfs.sh
Starting namenodes on [localhost]
localhost: Error: JAVA_HOME is not set and could not be found.
localhost: Error: JAVA_HOME is not set and could not be found.
Starting secondary namenodes [0.0.0.0]
0.0.0.0: Error: JAVA_HOME is not set and could not be found.
/opt/hadoop/2.5.1/sbin:
如果我尝试:
sh start-dfs.sh
start-dfs.sh: 82: /opt/hadoop/2.5.1/sbin/../libexec/hadoop-config.sh: Syntax error: word unexpected (expecting ")")
答案 0 :(得分:0)
使用bash而不是sh来调用脚本。这解决了我的问题。
答案 1 :(得分:0)
在hadoop.env.sh
中打开文件hadoop-xxx/etc/hadoop
并添加以下行
JAVA_HOME = "address of java"
答案 2 :(得分:0)
您需要在.bashrc文件中设置Java Enviornment。您可能还需要更新hadoop.env.sh
中的java_home值按照我的回答中的步骤进行操作,你的hadoop安装就可以了: [Problems with installing Hadoop on Ubuntu 12.04