clasnotfound异常

s1ag04yj  于 2021-05-30  发布在  Hadoop
关注(0)|答案(1)|浏览(323)

我有以下pom.xml。
pom.xml文件

  1. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  2. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  3. <modelVersion>4.0.0</modelVersion>
  4. <groupId>com.datasys.prasanna</groupId>
  5. <artifactId>hadoop-wordcount</artifactId>
  6. <version>1.0.0</version>
  7. <packaging>jar</packaging>
  8. <name>hadoop-wordcount</name>
  9. <url>http://maven.apache.org</url>
  10. <properties>
  11. <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  12. </properties>
  13. <dependencies>
  14. <dependency>
  15. <groupId>org.apache.hadoop</groupId>
  16. <artifactId>hadoop-core</artifactId>
  17. <version>1.2.1</version>
  18. </dependency>
  19. </dependencies>
  20. </project>

当我创建一个类似jar的mvn包时,我得到一个名为 hadoop-wordcount-1.0.0.jar 但是当我尝试像hadoopjar那样运行jar时,hadoop-wordcount-1.0.0.jar wordcount/input/out1
上面写着 Exception in thread "main" java.lang.ClassNotFoundException: WordCount wordcount是一个java文件,它有我的main方法。我在pom.xml中遗漏了什么吗?

h43kikqp

h43kikqp1#

如果wordcount类位于(java)包中(例如,如果您复制并粘贴了本例中的代码),则需要在命令行中提供完全限定的类名。
例如:

  1. hadoop jar hadoop-wordcount-1.0.0.jar org.myorg.WordCount /input /out1

相关问题