title: Java: com.sun.tools.javac.Main not found when trying to compile Hadoop program
body: <p>When I try to compile my program in Hadoop with this command</p>
  
  <pre class="lang-none prettyprint-override"><code>bin/hadoop com.sun.tools.javac.Main WordCounter.java
  </code></pre>
  
  <p>from Hadoop folder, it says</p>
  
  <pre class="lang-none prettyprint-override"><code>Error: Could not find or load main class com.sun.tools.javac.Main
  </code></pre>
  
  <p>I looked in similar threads where people suggested to check if <code>JAVA_HOME</code> is properly stated. So in <code>etc/hadoop/hadoop-env.sh</code>I added this line</p>
  
  <pre class="lang-none prettyprint-override"><code>export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
  </code></pre>
  
  <p>then checked if <code>tools.pack</code> is properly unpacked in <code>/usr/lib/jvm/java-7-openjdk-amd64/lib</code> and it was. Then I tried <code>javac -version</code> which gave </p>
  
  <pre class="lang-none prettyprint-override"><code>javac 1.7.0_65
  </code></pre>
  
  <p>I tried to reinstall Java but it didn't solve the problem.</p>