使用命令行在Windows中的hadoop上运行wordcount.jar

时间:2013-10-01 08:35:57

标签: java hadoop

我正在尝试在hadoop上运行一个简单的wordcount程序,但面临如下错误。

 Exception in thread "main" java.io.IOException: Error opening job jar: /user/asiapac/bmohanty6/wordcount/wordcount.jar
        at org.apache.hadoop.util.RunJar.main(RunJar.java:90)
Caused by: java.io.FileNotFoundException: \user\asiapac\bmohanty6\wordcount\wordcount.jar (The system cannot find the path specified)
 at java.util.zip.ZipFile.open(Native Method)
 at java.util.zip.ZipFile.<init>(Unknown Source)
 at java.util.zip.ZipFile.<init>(Unknown Source)
 at java.util.jar.JarFile.<init>(Unknown Source)
 at java.util.jar.JarFile.<init>(Unknown Source)
 at org.apache.hadoop.util.RunJar.main(RunJar.java:88)


我正在使用以下命令。

$ bin/hadoop jar /user/asiapac/bmohanty6/wordcount/wordcount.jar WordCount /user/asiapac/bmohanty6/wo
rdcount/input /user/asiapac/bmohanty6/wordcount/output

我正在使用Cygwin,hadoop-0.20.2并设置了伪节点。我还将wordcount.jar上传到了我的DFS。请参阅下面的DFS截图

enter image description here

我能够在eclipse中成功运行相同的wordcount程序。我根据this教程通过eclipse创建了wordcount.jar文件。我在网上搜索了很多但却无法理解如何解决这个问题。请帮帮我。

1 个答案:

答案 0 :(得分:0)

您需要在/之前添加user

bin/hadoop jar /user/asiapac/bmohanty6/wordcount/wordcount.jar WordCount /user/asiapac/bmohanty6/wordcount/input /user/asiapac/bmohanty6/wordcount/output

这使他们成为完全合格的路径。如果在/之前省略user,Hadoop将从当前目录中搜索。