在Apache Hadoop中执行helloworld.java [英] Executing helloworld.java in apache hadoop
问题描述
有人可以告诉我如何在apache hadoop中执行我的HelloWorld.java,其中包含
can someone pls tell me how can i execute my HelloWorld.java in apache hadoop which contains
class Helloworld
{
public static void main(String[] args)
{
Sytem.out.println("HelloWorld");
}
}
正在运行单个节点。请告诉我如何运行这段代码或请发送一个绝对可以理解的初学者链接。
Am running a single node. Kindly tell me how can i run this piece of code or pls a send a link which is understandable for an absolute beginner.
推荐答案
$HADOOP_HOME/bin/hadoop jar [your_jar_file]
您还可以使用 -jar
强制它作为本地作业运行。用于播放和调试。
You can also use -jar
to force it to run as a local job. Useful for playing and debugging.
虽然我没有用这样简单的应用程序进行测试,但我认为它应该打印该行然后完成。尽管如此,不要拘泥于我。 :-P
While I haven't tested with such a simple application, I think it should print the line and then be done. Don't hold me to that though. :-P
您可能需要指定 main
throws Exception
但我不是100%。我的代码有它。
You might need to specify main
throws Exception
but I'm not 100% on that. My code has it.
我希望有所帮助。正如其他答案中提到的那样,在未设置Jobs和MapReduce的情况下,Hadoop不会有任何收益。
I hope that helps. As mentioned in other answers, without getting into setting up Jobs and MapReduce, there's not going to be a gain from Hadoop.
这篇关于在Apache Hadoop中执行helloworld.java的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!