java 使用 hadoop 错误设置获取 JAVA_HOME
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32159750/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
getting JAVA_HOME is incorrectly set with hadoop
提问by Shri S Softwares
I just downloaded hadoop and unzipped the file. but when I run hadoop version command from command prompt , I'm getting below error . I double check and JAVA_HOME is set to "C:\Program Files\Java\jdk1.8.0_45" which looks ok to me .
我刚刚下载了 hadoop 并解压缩了文件。但是当我从命令提示符运行 hadoop version 命令时,我遇到了错误。我仔细检查了一下,JAVA_HOME 设置为“C:\Program Files\Java\jdk1.8.0_45”,这对我来说没问题。
C:\Users\shri-pc>hadoop version
The system cannot find the path specified.
Error: JAVA_HOME is incorrectly set.
Please update C:\JAVA\hadoop-2.6.0\conf\hadoop-env.cmd
'-Xmx512m' is not recognized as an internal or external command,
operable program or batch file.
Output of java -version command is coming properly . Please advice .
java -version 命令的输出正确。请指教 。
C:\Users\shri-pc>java -version
java version "1.8.0_51"
Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
Java HotSpot(TM) Client VM (build 25.51-b03, mixed mode)
采纳答案by Elliott Frisch
Your JAVA_HOME
should not include bin
. Change it from
你JAVA_HOME
不应该包括bin
. 改变它从
"C:\Program Files\Java\jdk1.8.0_45\bin"
to
到
"C:\Program Files\Java\jdk1.8.0_45"
And you can add it to your path (in Windows) like
你可以将它添加到你的路径中(在 Windows 中),比如
set "PATH=%PATH%;%JAVA_HOME%\bin"
回答by Shri S Softwares
Issue was with space in JAVA_HOME path . I change the path as below and it started working.
问题在于 JAVA_HOME 路径中的空间。我改变了如下路径,它开始工作。
from -
从 -
"C:\Program Files\Java\jdk1.8.0_45\bin"
“C:\Program Files\Java\jdk1.8.0_45\bin”
to -
到 -
"C:\PROGRA~1\Java\jdk1.8.0_45\bin"
"C:\PROGRA~1\Java\jdk1.8.0_45\bin"
.
.
回答by Aman Tandon
If your JAVA_HOME is Program Files
then change it to PROGRA~1
in JAVA_HOME environment variable.
如果您的 JAVA_HOME 是Program Files
然后将其更改为PROGRA~1
JAVA_HOME 环境变量。
回答by Pathum Goonathilake
Try changing the path from
尝试改变路径
C:\Program Files\Java\jdk1.8.0_45
C:\Program Files\Java\jdk1.8.0_45
to
到
C:\PROGRA~1\Java\jdk1.8.0_45
.
C:\PROGRA~1\Java\jdk1.8.0_45
.
回答by Kenny Monar
To me it worked to go to the java path and convert it to the windows short name, as indicated in this picture:
对我来说,它可以转到 java 路径并将其转换为 windows 短名称,如下图所示:
https://www.joe0.com/wp-content/uploads/2017/02/word-image-30.png
https://www.joe0.com/wp-content/uploads/2017/02/word-image-30.png
from this site:
从这个网站:
https://www.joe0.com/2017/02/02/how-to-install-a-hadoop-single-node-cluster-on-windows-10/
https://www.joe0.com/2017/02/02/how-to-install-a-hadoop-single-node-cluster-on-windows-10/