Hi i'm new to Hadoop and just started learning a couple days ago. I just followed the instructions from Digital Ocean to setup a Hadoop cluster. Afterwards I just tried a simple example program called WordCount from the Hadoop docs.
My hadoop version is 2.5.1 which is the same version with what is used on the tutorial, and it's running on Ubuntu Precise. I'm ensuring that I've done the proper setup as the tutorial said. Here's the end of my ~/.bashrc contents.
...
#HADOOP VARIABLES START
export JAVA_HOME=/usr/lib/jvm/java-7-oracle
export HADOOP_INSTALL=/usr/local/hadoop
export PATH=$PATH:$HADOOP_INSTALL/bin
export PATH=$PATH:$HADOOP_INSTALL/sbin
export HADOOP_MAPRED_HOME=$HADOOP_INSTALL
export HADOOP_COMMON_HOME=$HADOOP_INSTALL
export HADOOP_HDFS_HOME=$HADOOP_INSTALL
export YARN_HOME=$HADOOP_INSTALL
export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_INSTALL/lib/native
export HADOOP_OPTS="-Djava.library.path=$HADOOP_INSTALL/lib"
export HADOOP_PREFIX=/usr/local/hadoop
#HADOOP VARIABLES END
Also, I checked on my java home config and the result is like below
sudo update-alternatives --config java
There are 3 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java 1061 auto mode
1 /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java 1061 manual mode
2 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1051 manual mode
* 3 /usr/lib/jvm/java-7-oracle/jre/bin/java 1 manual mode
So i changed all JAVA_HOME value both in bashrc and hadoop-env.sh files to /usr/lib/jvm/java-7-oracle
. I'm ensuring as well that the Dfs and Yarn are both started.
However, when i compile the WordCount.java using this command
hadoop com.sun.tools.javac.Main WordCount.java
Nothing is going my way. I got this error. Note that i'm using Hadoop command instead bin/hadoop as the command is working properly since it was defined in bashrc
file.
Error: Could not find or load main class com.sun.tools.javac.Main
What is the possible cause of this error and how to get rid of this? It might be java classpath issue i think, but i'm still not be able to figure out the detail. Every workarounds regarding this problem i got are about executing java
or javac
command, not hadoop
command.
I just want to get the sample program working first, before getting started to learn how it works. Any help would be appreciated. Thanks..