Reputation: 2641
I have the following pom.xml.
POM.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.datasys.prasanna</groupId>
<artifactId>hadoop-wordcount</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
<name>hadoop-wordcount</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-core</artifactId>
<version>1.2.1</version>
</dependency>
</dependencies>
</project>
When I create a jar like mvn package, I get a jar named hadoop-wordcount-1.0.0.jar
But when I try to run the jar like hadoop jar hadoop-wordcount-1.0.0.jar WordCount /input /out1
It says Exception in thread "main" java.lang.ClassNotFoundException: WordCount
WordCount is the java file which has my main method. Am I missing out something in pom.xml?
Upvotes: 0
Views: 28
Reputation: 9651
If your WordCount class is in a (Java) package (for example, if you copied and pasted code from this example), then you'll need to provide the fully qualified class name on the command line.
For example:
hadoop jar hadoop-wordcount-1.0.0.jar org.myorg.WordCount /input /out1
Upvotes: 1