我正在尝试在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屏幕截图

我能够在Eclipse中成功运行相同的wordcount程序。我已经按照this教程通过eclipse创建了wordcount.jar文件。我在网络上搜索了很多内容,但不知道如何解决。请帮我。

最佳答案

您需要在/之前添加user:

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

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

关于java - 使用命令行在Windows的hadoop上运行wordcount.jar,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/19111530/

10-14 11:48