I'm trying to run a map reduce job. I created a runnable jar using eclipse and my input format class and output format class are in the same package as the class which starts the job. All these are included in the jar. I set the input and output format class as follows:
job.setInputFormatClass(fully_qualified_name_of_my_input_class.class);
job.setOutputFormatClass(fully_qualified_name_of_my_output_class.class);
But when i execute the jar using hadoop jar myJar.jar i get class not found exception for my output format class but i don't get it for my input format class. How to rectify this?? Here the stacktrace
java.lang.RuntimeException: java.lang.ClassNotFoundException: my-class-name
    at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:867)
    at org.apache.hadoop.mapreduce.JobContext.getOutputFormatClass(JobContext.java:235)
    at org.apache.hadoop.mapred.Task.initialize(Task.java:513)
    at org.apache.hadoop.mapred.MapTask.run(MapTask.java:353)
    at org.apache.hadoop.mapred.Child$4.run(Child.java:255)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:416)
    at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1121)
    at org.apache.hadoop.mapred.Child.main(Child.java:249)
Caused by: java.lang.ClassNotFoundException: my-class-name
    at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:266)
    at org.apache.hadoop.conf.Configuration.getClassByName(Configuration.java:820)
    at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:865)
    ... 8 more
				
                        
Try adding the following when you're setting up your job.
See Hadoop query regarding setJarByClass method of Job class for more info.