Could not find or load main class when trying to format namenode; hadoop installation on MAC OS X 10.9.2 Could not find or load main class when trying to format namenode; hadoop installation on MAC OS X 10.9.2 hadoop hadoop

Could not find or load main class when trying to format namenode; hadoop installation on MAC OS X 10.9.2


Due to the way the brew package is laid out, you need to point the HADOOP_PREFIX to the libexec folder in the package:

export HADOOP_PREFIX="/usr/local/Cellar/hadoop/2.2.0/libexec"

You would then remove the libexec from your declaration of the conf directory:

export HADOOP_CONF_DIR=$HADOOP_PREFIX/etc/hadoop


I had the same problem, it was because of rights "root".Run hadoop or hdfs command with sudo as before:

sudo hdfs namenode -format


Try $HADOOP_PREFIX/bin/hadoop namenode -format instead of $HADOOP_PREFIX/bin/hdfs namenode -format