Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java: com.sun.tools.javac.Main not found when trying to compile Hadoop program

Tags:

java

hadoop

When I try to compile my program in Hadoop with this command

bin/hadoop com.sun.tools.javac.Main WordCounter.java

from Hadoop folder, it says

Error: Could not find or load main class com.sun.tools.javac.Main

I looked in similar threads where people suggested to check if JAVA_HOME is properly stated. So in etc/hadoop/hadoop-env.shI added this line

export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64

then checked if tools.pack is properly unpacked in /usr/lib/jvm/java-7-openjdk-amd64/lib and it was. Then I tried javac -version which gave

javac 1.7.0_65

I tried to reinstall Java but it didn't solve the problem.

like image 506
Kudayar Pirimbaev Avatar asked Dec 04 '14 16:12

Kudayar Pirimbaev


1 Answers

Try to set HADOOP_CLASSPATH environment variable

export HADOOP_CLASSPATH=$JAVA_HOME/lib/tools.jar
like image 103
ponkin Avatar answered Sep 27 '22 21:09

ponkin