Java inner class not found although present in the same directory

I'm new to Hadoop and I'm trying to run a basic MapReduce program. I created a java file in my home folder class WordCountHdp1.java

I executed using hadoop com.sun.tools.javac.Main WordCountHdp1.java command. The class files for outer and inner classes were created.

Then I created a jar file using jar cf wc.jar WordCountHdp1.class command which created the necessary jar file.

But when I ran the hadoop jar wc.jar WordCount data1.txt out1 command, I get the following exception:

Exception in thread "main" java.lang.NoClassDefFoundError: WordCountHdp1$Map
        at WordCountHdp1.main(WordCountHdp1.java:81)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
        at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
Caused by: java.lang.ClassNotFoundException: WordCountHdp1$Map
        at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
        ... 7 more

This happens although I have the necessary inner classes class files in the same directory. Help.