-1

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.

enter image description here that is it can't point mapper and reducer class files.

How can I resolve this issue?

BinaryMee
  • 2,102
  • 5
  • 27
  • 46
  • To copy text from the Windows command line: 1) Right click and select 'Mark'. 2) Drag or shift+arrow across the text to copy. 3) Press Enter. 4) The text will now be on the clip-board ready to paste. -- Copy/paste the ***text*** of the error and include it as an [edit to the question](http://stackoverflow.com/posts/15267647/edit). – Andrew Thompson Mar 07 '13 at 09:42
  • Have you set the HADOOP_CLASSPATH environment variable? – Quetzalcoatl Mar 07 '13 at 09:43
  • @Quetzalcoatl: No. How to set this?? And how to map my Mapper and reducer classes?? – BinaryMee Mar 07 '13 at 09:45
  • @AndrewThompson : I am using Putty.. And i can't copy.. :( – BinaryMee Mar 07 '13 at 09:47
  • On second thought, I'm not sure you'll need to for the compile. Are you sure that `hadoop-0.18.0-core.jar` contains the hadoop examples from `com.hadoop.examples`? – Quetzalcoatl Mar 07 '13 at 09:49
  • IIRC in putty you can just click and drag to select text, then right click on the selection to copy? – Quetzalcoatl Mar 07 '13 at 09:50
  • @Quetzalcoatl: Yeah i think it is having that. Coz i complied Maper and reducer using same command. The classes generated stored in /com/hadoop/examples/anagram in my tmp folder. – BinaryMee Mar 07 '13 at 09:56
  • No when i right click it is not showing me custom menu to copy. Instead the selected text is passed as input when i r8 click. – BinaryMee Mar 07 '13 at 09:57

2 Answers2

2

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
Alper
  • 771
  • 1
  • 9
  • 27
0

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.

Chong Tang
  • 2,066
  • 15
  • 12