CLASSPATH issue in Hadoop on Cygwin while running "hadoop version" command

12,058

Solution 1

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

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

this solved it for me

Solution 2

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 "$@"

Solution 3

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
Share:
12,058

Related videos on Youtube

Manesh
Author by

Manesh

Shell Script Developer

Updated on September 16, 2022

Comments

  • Manesh
    Manesh over 1 year

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

    Error: Could not find or load main class org.apache.hadoop.util.VersionInfo
    
    • Manesh
      Manesh over 10 years
      Initially the command in "hadoop" script under ${HADOOP_COMMON_HOME}/bin/hadoop was as - "$JAVA" $JAVA_HEAP_MAX $HADOOP_OPTS $CLASS "$@" changed it to exec "$JAVA" -classpath "$(cygpath -pw "$CLASSPATH")" $JAVA_HEAP_MAX $HADOOP_OPTS $CLASS "$@"