Java 什么是“错误:无法找到或加载主类 org.apache.hadoop.util.RunJar”?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20522115/
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
What does "Error: Could not find or load main class org.apache.hadoop.util.RunJar"?
提问by Adelin
I am trying to run an example as it is pointed in Hadoop in Action bookpage 15. this is the command that needs to be run :
我正在尝试运行一个示例,因为它在 Action bookpage 15中的Hadoop 中指出。这是需要运行的命令:
bin/hadoop jar hadoop-*-examples.jar
but I get this error
但我收到这个错误
"Error: Could not find or load main class org.apache.hadoop.util.RunJar"
It seems like a classpath issue or something. Can someone point out some guideline ?
这似乎是一个类路径问题或什么的。有人可以指出一些指导方针吗?
Actually I am not able to run any of hadoop commands like version, fs, jar ... and so on .. !
实际上,我无法运行任何 hadoop 命令,例如 version、fs、jar ...等等..!
NOTE: I am using windows.
注意:我正在使用窗户。
回答by zhutoulala
[Edited]
Okay, i was reading too fast, you mentioned you were not able to run hadoop fs
commands as well. I guess you might miss a few congifurations or haven't start the services at all. Try following this tutorialstep by step.
[已编辑] 好吧,我读得太快了,你提到你也无法运行hadoop fs
命令。我猜您可能会错过一些配置或根本没有启动服务。尝试逐步按照本教程进行操作。
you will need to pass in the class name, for example:
您需要传入类名,例如:
bin/hadoop jar hadoop-*-examples.jar org.apache.hadoop.examples.WordCount [input] [output]
回答by Sergey
It is probably so late answer, but any way.
答案可能太晚了,但无论如何。
Just check that HADOOP_PREFIX environment variable is set correctly (points to your hadoop installed directory).
只需检查 HADOOP_PREFIX 环境变量是否设置正确(指向您的 hadoop 安装目录)。
回答by ice
you need check your environment variable HADOOP_PREFIX=/path/to/hadoop
你需要检查你的环境变量 HADOOP_PREFIX=/path/to/hadoop
回答by Eduardo Sanchez-Ros
Setting the HADOOP_CLASSPATH
as follows in your ~/.bashrc
worked for me:
HADOOP_CLASSPATH
在您~/.bashrc
为我工作中设置如下:
export HADOOP_CLASSPATH=$(cygpath -pw $(hadoop classpath)):$HADOOP_CLASSPATH
export HADOOP_CLASSPATH=$(cygpath -pw $(hadoop classpath)):$HADOOP_CLASSPATH
回答by surfealokesea
As described in documentation: http://hadoop.apache.org/docs/r2.6.5/hadoop-project-dist/hadoop-common/SingleCluster.html
如文档中所述:http: //hadoop.apache.org/docs/r2.6.5/hadoop-project-dist/hadoop-common/SingleCluster.html
You have to set HADOOP_PREFIX pointing to your hadoop installation folder.
您必须将 HADOOP_PREFIX 设置为指向您的 hadoop 安装文件夹。
This is an example script to start in stand-alone mode:
这是一个以独立模式启动的示例脚本:
#!/bin/bash
cd /etc/hadoop-2.6.5/
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/jre
export HADOOP_PREFIX=/etc/hadoop-2.6.5
mkdir input
cp etc/hadoop/*.xml input
bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.6.5.jar grep input output 'dfs[a-z.]+'
cat output/*