配置Hadoop显示JAVA_HOME is not set。急求答案,谢谢!

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了配置Hadoop显示JAVA_HOME is not set。急求答案,谢谢!相关的知识,希望对你有一定的参考价值。

如图,JAVA_HOME is not set
D:\hadoop-1.0.3\conf中的hadoop-env.sh文件中JAVA_HOME已经用写字板改为:
export JAVA_HOME=/cygdrive/d/Java/jdk1.6.0_29
我的JAVA装在D盘Java中,感觉已经配好了,为什么还是显示not set呢?
急,谢谢了!

应该是系统环境变量设置了就可以了,不用再cygwin中设置吧

这个是我这里的配置

你查下XP或win7的JDK设置

希望对你有帮助。

参考技术A 没看清就乱回答,这是因为你修改hadoop-env.sh时用的是window自带的写字板,保存的时候用的是window的回车换行\r\n,只需要用工具打开hadoop-env.sh,另存成linux格式的就可以了追问

用什么工具啊?

之前是因为export前面的注释符号“#”没删除,导致JAVA_HOME is not set这个问题。改了以后又出现了另外的问题,输入命令后


这是为什么啊?

本回答被提问者采纳
参考技术B Java_HOME,就是jdk的安装目录,具体方法:下载个JDK,安装,然后打开控制面板》系统》高级系统设置》高级》环境变量》点击编辑,变量名为Java_Home,变量值为Java_Home的安装路径 参考技术C export命令是暂时的,命令一结束就没用了

hadoop启动时报错,java: No such file or directory和localhost: Error: JAVA_HOME is not set.

hadoop-env.sh文件中配置为

# The java implementation to use. Required.
# export JAVA_HOME=/cygdrive/d/Java/jdk1.6.0_26

jdk1.6.0_26安装路径为:

D:\Java\jdk1.6.0_26\

电脑中环境变量java_home为:

D:\Java\jdk1.6.0_26\;D:\Java\jdk1.6.0_26\jre\bin

完全按照《Hadoop开发者》第一期,在win7环境下配置的,运行./start-all.sh,报错java: No such file or directory和localhost: Error: JAVA_HOME is not set.

william@william-PC /cygdrive/d/hadoop/run/bin
$ ls
hadoop slaves.sh start-mapred.sh stop-mapred.sh
hadoop-config.sh start-all.sh stop-all.sh task-controller
hadoop-daemon.sh start-balancer.sh stop-balancer.sh
hadoop-daemons.sh start-dfs.sh stop-dfs.sh
rcc start-jobhistoryserver.sh stop-jobhistoryserver.sh

william@william-PC /cygdrive/d/hadoop/run/bin
$ ./start-all.sh
starting namenode, logging to /cygdrive/d/hadoop/run/libexec/../logs/hadoop-william-name node-william-PC.out
/cygdrive/d/hadoop/run/libexec/../bin/hadoop: line 321: D:\Java\jdk1.6.0_26\;D:\Java\jdk 1.6.0_26\jre\bin/bin/java: No such file or directory
/cygdrive/d/hadoop/run/libexec/../bin/hadoop: line 387: D:\Java\jdk1.6.0_26\;D:\Java\jdk 1.6.0_26\jre\bin/bin/java: No such file or directory
/cygdrive/d/hadoop/run/libexec/../bin/hadoop: line 387: exec: D:\Java\jdk1.6.0_26\;D:\Ja va\jdk1.6.0_26\jre\bin/bin/java: cannot execute: No such file or directory
localhost: starting datanode, logging to /cygdrive/d/hadoop/run/libexec/../logs/hadoop-w illiam-datanode-william-PC.out
localhost: Error: JAVA_HOME is not set.
localhost: starting secondarynamenode, logging to /cygdrive/d/hadoop/run/libexec/../logs /hadoop-william-secondarynamenode-william-PC.out
localhost: Error: JAVA_HOME is not set.
starting jobtracker, logging to /cygdrive/d/hadoop/run/libexec/../logs/hadoop-william-jo btracker-william-PC.out
/cygdrive/d/hadoop/run/libexec/../bin/hadoop: line 321: D:\Java\jdk1.6.0_26\;D:\Java\jdk 1.6.0_26\jre\bin/bin/java: No such file or directory
/cygdrive/d/hadoop/run/libexec/../bin/hadoop: line 387: D:\Java\jdk1.6.0_26\;D:\Java\jdk 1.6.0_26\jre\bin/bin/java: No such file or directory
/cygdrive/d/hadoop/run/libexec/../bin/hadoop: line 387: exec: D:\Java\jdk1.6.0_26\;D:\Ja va\jdk1.6.0_26\jre\bin/bin/java: cannot execute: No such file or directory
localhost: starting tasktracker, logging to /cygdrive/d/hadoop/run/libexec/../logs/hadoo p-william-tasktracker-william-PC.out
localhost: Error: JAVA_HOME is not set.

刚开始学hadoop,就遇到这个问题,已经周旋好几天好,始终解决不了,拜求大虾帮小弟看看啊!

参考技术A # The java implementation to use. Required.
# export JAVA_HOME=/cygdrive/d/Java/jdk1.6.0_26

------->
# The java implementation to use. Required
export JAVA_HOME=/cygdrive/d/Java/jdk1.6.0_26
参考技术B 很明显是java home没有配好 ,输入cd $JAVA_HOME,看行不行?本回答被提问者采纳 参考技术C 1234123

以上是关于配置Hadoop显示JAVA_HOME is not set。急求答案,谢谢!的主要内容,如果未能解决你的问题,请参考以下文章

启动hadoop,报错Error JAVA_HOME is not set and could not be found

hadoop start-all.sh报错JAVA_HOME is not set and could not be found.

启动hadoop时出现ERROR: JAVA_HOME is not set and could not be found.解决办法

windows下安装hadoop总是出错 JAVA_HOME is not set.

hadoop启动守护进程报JAVA_HOME is not set and could not be found

hadoop Error: JAVA_HOME is not set and could not be found.