Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Issue with Hadoop version command. Could not find or load main class error on my computer name

 
Geetha Gubendran
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to run hadoop version command. While doing so, I am getting the below error.

Could not find or load main class Achintya

I can understand that it is looking for Achintya.java file. Achintya is my computer name. Why does it has to look for that class.

I really couldnot fix this issue. I made all the script changes suggested for Could not find or load main class - while executing hadoop version command. but nothing works. Kindly help.
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Post the exact command that you are running and also the exact output of it.

 
Geetha Gubendran
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
$ hadoop
Usage: hadoop [--config confdir] COMMAND
where COMMAND is one of:
fs run a generic filesystem user client
version print the version
jar <jar> run a jar file
checknative [-a|-h] check native hadoop and compression libraries availabilit y
distcp <srcurl> <desturl> copy file or directories recursively
archive -archiveName NAME -p <parent path> <src>* <dest> create a hadoop archi ve
classpath prints the class path needed to get the
Hadoop jar and the required libraries
daemonlog get/set the log level for each daemon
or
CLASSNAME run the class named CLASSNAME

Most commands print help when invoked w/o parameters.

Praneel Achintya@PraneelAchintya /cygdrive/c/geet/hadoop/hadoopinstall/hadoop-2. 5.1/bin
$ echo $HADOOP_INSTALL
C:\geet\Hadoop\HadoopInstall\hadoop-2.5.1;

Praneel Achintya@PraneelAchintya /cygdrive/c/geet/hadoop/hadoopinstall/hadoop-2. 5.1/bin
$ echo $JAVA_HOME
C:\geet\JavaExec\jdk1.8.0_25

Praneel Achintya@PraneelAchintya /cygdrive/c/geet/hadoop/hadoopinstall/hadoop-2. 5.1/bin
$ echo $path


Praneel Achintya@PraneelAchintya /cygdrive/c/geet/hadoop/hadoopinstall/hadoop-2. 5.1/bin
$ echo $PATH
/usr/local/bin:/usr/bin:/cygdrive/c/ProgramData/Oracle/Java/javapath:/cygdrive/c /Program Files/Common Files/Microsoft Shared/Windows Live:/cygdrive/c/Program Fi les (x86)/Common Files/Microsoft Shared/Windows Live:/cygdrive/c/Program Files ( x86)/AMD APP/bin/x86_64:/cygdrive/c/Program Files (x86)/AMD APP/bin/x86:/cygdriv e/c/Program Files (x86)/Intel/iCLS Client:/cygdrive/c/Program Files/Intel/iCLS C lient:/cygdrive/c/windows/system32:/cygdrive/c/windows:/cygdrive/c/windows/Syste m32/Wbem:/cygdrive/c/windows/System32/WindowsPowerShell/v1.0:/cygdrive/c/Program Files/Intel/Intel(R) Management Engine Components/DAL:/cygdrive/c/Program Files /Intel/Intel(R) Management Engine Components/IPT:/cygdrive/c/Program Files (x86) /Intel/Intel(R) Management Engine Components/DAL:/cygdrive/c/Program Files (x86) /Intel/Intel(R) Management Engine Components/IPT:/cygdrive/c/Program Files (x86) /ATI Technologies/ATI.ACE/Core-Static:/cygdrive/c/Program Files (x86)/Windows Li ve/Shared:/cygdrive/c/Program Files/Microsoft SQL Server/110/Tools/Binn:/cygdriv e/c/Program Files/Microsoft/Web Platform Installer:/cygdrive/c/geet/JavaExec/jdk 1.8.0_25/bin:/cygdrive/c/geet/Hadoop/HadoopInstall/hadoop-2.5.1/bin

Praneel Achintya@PraneelAchintya /cygdrive/c/geet/hadoop/hadoopinstall/hadoop-2. 5.1/bin
$ ./hadoop version
Error: Could not find or load main class Achintya
 
GeethGubi Gubendran
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got this fixed. The issue was because of space in my computer's username. My computers username was Praneel Achintya. The issue was because of the space in between Praneel and Achintya. I tried to change the computer name but nothing worked. So I created another user and reinstalled hadoop related stuff in my new user login. Then when I ran the hadoop version command, I got the error on VersionInfo class (Error: Could not find or load main class org.apache.hadoop.util.VersionInfo)

I fixed this versionInfo error with classpath fix in hadoop file in bin directory of hadoop installation.

Initially the command in "hadoop" script under ${HADOOP_INSTALL}/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 "$@" and it all worked.

Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic