我已经成功安装了 hadoop。但是,当我运行 hadoop 命令时,它会提示以下错误:
C:\>hadoop version
'JAVA_HOME' is not recognized as an internal or external command,
operable program or batch file.
Hadoop 2.7.3
Subversion https://git-wip-us.apache.org/repos/asf/hadoop.git -r
baa91f7c6bc9cb92be5982de4719c1c8af91ccff Compiled by root on 2016-
0818T01:41ZCompiled with protoc 2.5.0 From source with checksum
2e4ce5f957ea4db193bce3734ff29ff4 This command was run using /C:/hadoop-
2.7.3/share/hadoop/common/hadoop-common-2.7.3.jar
我检查并修复了 JAVE_HOME 和 PATH 的环境变量。我发现路径没有问题,但在运行 hadoop 命令或连接到 HDFS 时,上述错误仍然存在。以下是我运行 javac 命令时的输出。
C:\>javac
Usage: javac <options> <source files>
where possible options include:
-g Generate all debugging info
-g:none Generate no debugging info
-g:{lines,vars,source} Generate only some debugging info
-nowarn Generate no warnings
-verbose Output messages about what the compiler is doing
-deprecation Output source locations where deprecated APIs are
我该如何解决这个问题?
最佳答案
在 Windows 上,您需要在控制面板的环境变量中输入 JAVA_HOME
(您输入了 JAVE_HOME
)。
否则您不需要编辑任何 Hadoop 脚本,但在脚本中,它将是 %JAVA_HOME%
。因此,在 PATH
变量中,您可以拥有类似
%JAVA_HOME%\bin:%HADOOP_HOME%\bin
如果你想使用 Hadoop 2.7.x,那么它应该是(当前)2.7.7 来捕获错误修复 + 补丁
关于java - Windows 中的 Hadoop 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52007073/