title: Hadoop Compilation Error: Could not find or load main class com.sun.tools.javac.Main
body: <p>I am trying to compile the simple WordCount.java program using Hadoop MapReduce using the command: <code>hadoop com.sun.tools.javac.Main WordCount.java</code></p>
  
  <p>But I keep getting the message:</p>
  
  <blockquote>
    <p>Error: Could not find or load main class com.sun.tools.javac.Main</p>
  </blockquote>
  
  <p>My exports are as follows: </p>
  
  <pre><code>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
  </code></pre>
  
  <p>I've checked my JAVA_HOME/lib directory and confirmed that the tools.jar file is there. </p>
  
  <p>My other haddop functions seem to be working properly. I can run <code>hadoop version</code> and it returns my hadoop version number. I can run <code>hdfs dfs -ls</code> and it returns the listing of my hdfs directory. </p>
  
  <p>Any help in figuring out why I can't compile would be greatly appreciated</p>