title: Could not find or load main class org.apache.hadoop.hdfs.server.namenode.Namenode
body: <p>I know this has been asked before but I could not figure out the solution. I am getting the below error when I am trying to run <code>hdfs name node -format</code>:</p>
  
  <blockquote>
    <p>Could not find or load main class org.apache.hadoop.hdfs.server.namenode.Namenode</p>
  </blockquote>
  
  <p><a href="http://alanxelsys.com/hadoop-v2-single-node-installation-on-centos-6-5/">I followed the instructions from this website to install on my centos machine.</a> The only difference is that I installed using root instead of hadoopuser as mentioned in the link. </p>
  
  <h3>Bashrc</h3>
  
  <pre class="lang-sh prettyprint-override"><code># User specific aliases and functions
  
  export JAVA_HOME=/usr/lib/jvm/jre-1.7.0-openjdk.x86_64/
  export HADOOP_INSTALL=/usr/local/hadoop
  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 PATH=$PATH:$HADOOP_INSTALL/sbin
  export PATH=$PATH:$HADOOP_INSTALL/bin
  </code></pre>
  
  <h3>hadoop-env.sh</h3>
  
  <pre class="lang-sh prettyprint-override"><code>export JAVA_HOME=/usr/lib/jvm/jre-1.7.0-openjdk.x86_64/
  </code></pre>
  
  <h3>Mapred</h3>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;property&gt;
      &lt;name&gt;mapreduce.framework.name&lt;/name&gt;
      &lt;value&gt;yarn&lt;/value&gt;
  &lt;/property&gt;
  </code></pre>
  
  <h3>Yarn-site.xml</h3>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;property&gt;
      &lt;name&gt;yarn.nodemanager.aux-services&lt;/name&gt;
      &lt;value&gt;mapreduce_shuffle&lt;/value&gt;
  &lt;/property&gt;
  </code></pre>
  
  <h3>core-site.xml</h3>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;property&gt;
      &lt;name&gt;fs.default.name&lt;/name&gt;
      &lt;value&gt;hdfs://localhost:9000&lt;/value&gt;
  &lt;/property&gt;
  </code></pre>
  
  <h3>hdfs-site.xml</h3>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;property&gt;
      &lt;name&gt;dfs.replication&lt;/name&gt;
      &lt;value&gt;1&lt;/value&gt;
  &lt;/property&gt;
  
  &lt;property&gt;
      &lt;name&gt;dfs.name.dir&lt;/name&gt;
      &lt;value&gt;file:///home/hadoopspace/hdfs/namenode&lt;/value&gt;
  &lt;/property&gt;
  
  &lt;property&gt;
      &lt;name&gt;dfs.data.dir&lt;/name&gt;
      &lt;value&gt;file:///home/hadoopspace/hdfs/datanode&lt;/value&gt;
  &lt;/property&gt;
  </code></pre>