Reputation: 1852
I am trying to work through this Hadoop MapReduce Word Count example given in the book Data Analytics with Hadoop which had me setup a Hadoop pseudo-distributed development environment. So now I am trying to run a Word Count example. I downloaded the .java files, WordCount folder, from Hadoop Fundamentals. The code given in the book to start this process is:
hostname $ hadoop com.sun.tools.javac.Main WordCount.java
I run this and receive the following errors:
hadoop@gh0st-VirtualBox:/home/gh0st$ hadoop com.sun.tools.javac.Main Downloads/WordCount/WordCount.java
Downloads/WordCount/WordCount.java:32: error: cannot find symbol
job.setMapperClass(WordMapper.class);
^
symbol: class WordMapper
location: class WordCount
Downloads/WordCount/WordCount.java:33: error: cannot find symbol
job.setReducerClass(SumReducer.class);
^
symbol: class SumReducer
location: class WordCount
Note: Downloads/WordCount/WordCount.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
2 errors
The WordMapper.java and SumReducer.java files are located in the same WordCount folder from which I'm running the WordCount.java file. I'm not sure where to start from here considering all I read regarding this. My $JAVA_HOME
is /usr/lib/jvm/java-7-openjdk-amd64/
. My $CLASS_PATH
is $HADOOP_HOME/share/hadoop/common/hadoop-common-2.7.3.jar
. I'm not sure what other information is needed to fix this issue--I'll add whatever else is needed. The following links are what I looked at and tried:
I am using Ubuntu 14.04 within VirtualBox.
Upvotes: 1
Views: 3259
Reputation: 1517
This worked for me:
Hadoop classpath
:export CLASSPATH=`hadoop classpath`
echo $CLASSPATH
javac -d . WC_Runner.java WC_Mapper.java WC_Reducer.java
Upvotes: 1
Reputation: 1852
So after some deep digging, I found the answer. The answer is in the comment in the following link: Driver Class Compilation Error
I had to compile all the files together. The new code looks like this:
hadoop com.sun.tools.javac.Main Downloads/WordCount/WordCount.java Downloads/WordCount/WordMapper.java Downloads/WordCount/SumReducer.java
Hope this helps someone!
Upvotes: 4