Because map and reduce run on different machines, all your referenced classes and jars must move from machine to machine.
If you have package jar, and run on your desktop, @ThomasJungblut's answer is OK. But if you run in Eclipse, right-click your class and run, it doesn't work.
Instead of:
job.setJarByClass(Mapper.class);
Use:
job.setJar("build/libs/hdfs-javac-1.0.jar");
At the same time, your jar's manifest must include Main-Class property, which is your main class.
For Gradle users, can put these lines in build.gradle:
jar {
manifest {
attributes("Main-Class": mainClassName)
}}