Compiling hadoop java files

≡放荡痞女 提交于 2019-12-26 06:50:06

问题


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?


回答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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!