I am trying to compile the simple WordCount.java program using Hadoop MapReduce using the command: hadoop com.sun.tools.javac.Main WordCount.java
But I keep getting the message:
Error: Could not find or load main class com.sun.tools.javac.Main
My exports are as follows:
export JAVA_HOME=/Library/Java/JavaVirtualMachine/jdk1.8.0_101.jdk/Contents/Home
export HADOOP_HOME=/usr/local/Cellar/hadoop/2.7.1
export HADOOP_PREFIX=$HADOOP_HOME/libexec
export HADOOP_MAPRED_HOME=$HADOOP_PREFIX
export HADOOP_COMMON_HOME=$HADOOP_PREFIX
export HADOOP_HDFS_HOME=$HADOOP_PREFIX
export YARN_HOME=$HADOOP_PREFIX
export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_PREFIX
export HADOOP_CLASSPATH=$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$HADOOP_HOME/sbin:$HADOOP_HOME/bin
I've checked my JAVA_HOME/lib directory and confirmed that the tools.jar file is there.
My other haddop functions seem to be working properly. I can run hadoop version
and it returns my hadoop version number. I can run hdfs dfs -ls
and it returns the listing of my hdfs directory.
Any help in figuring out why I can't compile would be greatly appreciated