mt_had mt_had - 7 months ago 92
Java Question

install hadoop 2.7 on ubuntu 15.04 cannot find or load main class

I installed Hadoop 2.7.0 single node cluster on Ubuntu 15.04 following commands from here and nearly all went fine until the command formatting hdfs.

When I enter

$ hdfs namenode -format


I get error:
Could not find or load main class Djava.librarary.path=.usr.local.hadoop.lib


In bashrc I have

#hadoop variables
export JAVA_HOME=/usr/lib/jvm/java-8-oracle/lib/amd64
export HADOOP_HOME=/usr/local/hadoop
export PATH=$PATH:$HADOOP_HOME/bin
export PATH=$PATH:$HADOOP_HOME/sbin
export HADOOP_MAPRED_HOME=$HADOOP_HOME
export HADOOP_COMMON_HOME=$HADOOP_HOME
export HADOOP_HDFS_HOME=$HADOOP_HOME
export YARN_HOME=$HADOOP_HOME
export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/native
export HADOOP_OPTS="-Djava.library.path=$HADOOP_HOME/lib"


In hadoop-env.sh I have

export JAVA_HOME="/usr/lib/jvm/java-8-oracle"


What do I do to get rid of the error?

I'm assuming something's wrong with the java path but I can't figure what...
Can anybody help?...

Thanks in advance.

Answer

Set the following variables alone in bashrc. Remove all other variables that you have set and then try

export JAVA_HOME=/usr/lib/jvm/java-8-oracle
export HADOOP_HOME=/usr/local/hadoop
export PATH=$PATH:$HADOOP_HOME/bin
export PATH=$PATH:$HADOOP_HOME/sbin

Let me know if still you have any problem.