问题
I need to compile Java Hadoop programs.
I have compiled and got .class files for mapper and reducer.
But when I compile mainjava file, i keep getting this error.

How can I resolve this issue?
回答1:
You have to give all of your source files to javac
Example:
javac -classpath /usr/local/hadoop/hadoop-core-1.0.4.jar -sourcepath src/ -d build/ MyMain.java MyMapper.java MyReducer.java
回答2:
hadoop-core-${VERSION}.jar is in ${HADOOP_HOME}/share/common directory.
javac --classpath=${HADOOP_HOME}/share/common/hadoop-core-${HADOOP_VERSION}.jar YourClass.java
will do the work.
来源:https://stackoverflow.com/questions/15267647/compiling-hadoop-java-files