简体   繁体   中英

Compiling hadoop java files

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.

在此处输入图片说明 that is it can't point mapper and reducer class files.

How can I resolve this issue?

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM