hadoop in windows with cygwin noclassdefinition fo

2019-09-01 04:12发布

i am trying to install hadoop in my windows 7 environment and run it with cygwin. i have downloaded and installed cygwin and have configured ssh i have set java class path inside cygwin .bashrc and set up all hadoop configuration files My .bashrc file is listed

export JAVA_HOME="C:\\Program Files\\Java\\jdk1.6.0_24"
export HADOOP_HOME=/home/user/hadoop
export HADOOP_MAPRED_HOME=/home/user/hadoop
export HADOOP_COMMON_HOME=/home/user/hadoop
export HADOOP_HDFS_HOME=/home/user/hadoop
export YARN_HOME=/home/user/hadoop
export HADOOP_CONF_DIR=/home/user/hadoop/etc/hadoop

but get class not found error when i run the folowing commands the error on cygwin terminal is :

$ ./hadoop version
java.lang.NoClassDefFoundError: org/apache/hadoop/util/VersionInfo
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.util.VersionInfo
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: org.apache.hadoop.util.VersionInfo.  Program will exit.
Exception in thread "main"

why do i get a noclass definition found error, is there some thing else i need to do with configuration . am using windows 7 64bit and hadoop version 2.2.0

1条回答
霸刀☆藐视天下
2楼-- · 2019-09-01 05:00

Some tips:

  1. Install JDK in a folder, the path must be without any white space.
  2. Set the path like this:

    $ export JAVA_HOME=/cygdrive/c/Program_Files/Java/jdk1.7.0_71
    
  3. Make sure that the export was succesfull by executing:

    $ env | grep -i JAVA_HOME
    

    This should print:

    JAVA_HOME=/cygdrive/c/Program_Files/Java/jdk1.7.0_71
    
  4. If you want to see the version, just execute:

    sh -x bin/hdfs version
    
  5. Run .sh scripts with sh -x:

    sh -x bin/hdfs namenode -format
    
查看更多
登录 后发表回答