title: Hadoop - Could not find or load main class org.apache.hadoop.hdfs.server.namenode.NameNode
body: <p>I got this error when I tried to execute the hadoop command with namenode and format parameters.</p>
  
  <pre><code>C:\hadoop-2.5.2\bin&gt;hadoop namenode -format
  DEPRECATED: Use of this script to execute hdfs command is deprecated.
  Instead use the hdfs command for it.
  Error: Could not find or load main class org.apache.hadoop.hdfs.server.namenode.
  NameNode
  </code></pre>
  
  <p>This is the output of the export command.All these variables are declared as environmental user variables.</p>
  
  <pre><code>declare -x CLASSPATH="C:\\hadoop-2.5.2\\share\\hadoop\\common;C:\\Java\\jdk1.7.0_51\\bin;C:\\Java\\jdk1.7.0_51\\jre\\bin;"
  declare -x JAVA_HOME="C:\\Java\\jdk1.7.0_51"
  declare -x HADOOP_COMMON_HOME="C:\\hadoop-2.5.2"
  declare -x HADOOP_HDFS_HOME="C:\\hadoop-2.5.2\\share\\hadoop\\hdfs"
  declare -x HADOOP_PREFIX="C:\\hadoop-2.5.2\\bin\\hadoop"
  declare -x HADOOP_YARN_HOME="C:\\hadoop-2.5.2\\share\\hadoop\\yarn"
  
  
  C:\hadoop-2.5.2\bin&gt;hadoop version
  Hadoop 2.5.2
  Subversion https://git-wip-us.apache.org/repos/asf/hadoop.git -r cc72e9b000545b8
  6b75a61f4835eb86d57bfafc0
  Compiled by jenkins on 2014-11-14T23:45Z
  Compiled with protoc 2.5.0
  From source with checksum df7537a4faa4658983d397abf4514320
  This command was run using /C:/hadoop-2.5.2/share/hadoop/common/hadoop-common-2.
  5.2.jar
  </code></pre>
  
  <p>When I ran hadoop classpath command, there was no path which had any jar file in it, which made me think there was an error here. Can anyone tell if the error is actually with classpath? </p>
  
  <p>The env variable classpath has the path till the common directory which has the jar files. Should the hadoop classpath also be modified? If yes, what should i add to it?</p>
  
  <pre><code>declare -x CLASSPATH="C:\\hadoop-2.5.2\\share\\hadoop\\common;C:\\Java\\jdk1.7.0_51\\bin;C:\\Java\\jdk1.7.0_51\\jre\\bin;"
  
  C:\hadoop-2.5.2\bin&gt;hadoop classpath
  C:\hadoop-2.5.2\etc\hadoop;C:\hadoop-2.5.2\share\hadoop\common\lib\*;C:\hadoop-2
  .5.2\share\hadoop\common\*;C:\hadoop-2.5.2\share\hadoop\hdfs\share\hadoop\hdfs\*
  ;C:\hadoop-2.5.2\share\hadoop\yarn\share\hadoop\yarn\*;C:\hadoop-2.5.2\share\had
  oop\mapreduce\lib\*;C:\hadoop-2.5.2\share\hadoop\mapreduce\*
  </code></pre>
  
  <p>Thanks for the help. Please do not mark this as duplicate, as I have spent a lot of time going through these threads without any breakthrough.</p>
  
  <p><a href="https://stackoverflow.com/questions/23017937/could-not-find-or-load-main-class-when-trying-to-format-namenode-hadoop-install">Could not find or load main class when trying to format namenode; hadoop installation on MAC OS X 10.9.2</a>
  <a href="https://stackoverflow.com/questions/24718997/could-not-find-or-load-main-class-org-apache-hadoop-hdfs-server-namenode-namenod">Could not find or load main class org.apache.hadoop.hdfs.server.namenode.Namenode</a></p>