Support Questions

Find answers, ask questions, and share your expertise

Exception in thread "main" java.lang.ClassNotFoundException: WordCount / in Hadoop

avatar
New Contributor

I have created 'WordCount.JAR' file and executed the WordCount Program in java using jar file but i am getting exception .

hadoop@ubuntu:~/workspace$ hadoop jar WordCount.JAR WordCount siva/file1.txt Warning: $HADOOP_HOME is deprecated. Exception in thread "main" java.lang.ClassNotFoundException: WordCount at java.net.URLClassLoader$1.run(URLClassLoader.java:212) at java.net.URLClassLoader$1.run(URLClassLoader.java:201) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:200) at java.lang.ClassLoader.loadClass(ClassLoader.java:325) at java.lang.ClassLoader.loadClass(ClassLoader.java:270) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:274) at org.apache.hadoop.util.RunJar.main(RunJar.java:149)

1 REPLY 1

avatar
Master Mentor

@gopi seelam

The "WordCount" program is written with java "package" instruction ? If yes then you should pass the fully qualified classname.

- In order to verify it can you please share the output of the following command this will help us in knowing if you are passing the correct classname there?

jar  -tvf  WordCount.JAR

.

Also please check if your Jar file name is in Uppercase or lowercase? Like "WordCount.JAR" Or "WordCount.jar"

If the jar file name is in lowercase then you should pass the correct file name in same case.

$ hadoop jar WordCount.jar WordCount siva/file1.txt

.