CLASSPATH issue in Hadoop on Cygwin while running “hadoop version” command

前端 未结 3 517
孤城傲影
孤城傲影 2020-12-19 20:00

I have installed Hadoop version 2.1 beta from Apache on Windows using Cygwin terminal. Running the command hadoop version gets me this error :

E         


        
相关标签:
3条回答
  • 2020-12-19 20:55

    Add the below statement in hadoop-config.sh @ line no 285

    CLASSPATH=`cygpath -wp "$CLASSPATH"`
    
    //Comments goes here
    
    if [ "$HADOOP_CLASSPATH" != "" ]; then
      # Prefix it if its to be preceded
      if [ "$HADOOP_USER_CLASSPATH_FIRST" != "" ]; then
        CLASSPATH=${HADOOP_CLASSPATH}:${CLASSPATH}
      else
        CLASSPATH=${CLASSPATH}:${HADOOP_CLASSPATH}
      fi
    fi
    

    Output :

    admin@admin-PC /cygdrive/e/hadoop/hadoop-2.2.0/bin
    $ ./hadoop version
    Hadoop 2.2.0
    Subversion https://svn.apache.org/repos/asf/hadoop/common -r 1529768
    Compiled by hortonmu on 2013-10-07T06:28Z
    Compiled with protoc 2.5.0
    From source with checksum 79e53ce7994d1628b240f09af91e1af4
    This command was run using /E:/hadoop/hadoop-2.2.0/share/hadoop/common/hadoop-common-2.2.0.jar
    
    0 讨论(0)
  • 2020-12-19 21:01

    I met the same issue when trying to install Hadoop 2.2.0 on windows 2008 Server Sp1 64bit.

    I have installed cygwin64 and configured openssh.

    The answer by user2870991 works for me. Modify the \hadoop\bin\hadoop script as below, comment the original exec line and insert the new one.

      #exec "$JAVA" $JAVA_HEAP_MAX $HADOOP_OPTS $CLASS "$@"
      #add the -claspath "$(cygpath -pw "$CLASSPATH")" TO FIX the script running in cygwin
      exec "$JAVA" -classpath "$(cygpath -pw "$CLASSPATH")" $JAVA_HEAP_MAX $HADOOP_OPTS $CLASS "$@"
    
    0 讨论(0)
  • 2020-12-19 21:02

    you can also add the following to your ~/.bashrc

    export HADOOP_CLASSPATH=$(cygpath -pw $(hadoop classpath)):$HADOOP_CLASSPATH
    

    this solved it for me

    0 讨论(0)
提交回复
热议问题