0
votes

I am completely new to Hadoop and I am trying to install Hadoop single node cluster on ubuntu but I am unable to figure out the reason I am unable to.I am following the tutorials in the following link "http://codesfusion.blogspot.in/2013/10/setup-hadoop-2x-220-on-ubuntu.html?m=1" Everything went smoothly but when I give the command "Hadoop version" I get the following error. "/usr/local/hadoop/bin/hadoop: line 133: /usr/lib/jvm/jdk//bin/java: No such file or directory" I also opened the same file and searched the entire file but could not find such a line at all . my .bashrc

export JAVA_HOME=/usr/lib/jvm/jdk/
export HADOOP_INSTALL=/usr/local/hadoop
export PATH=$PATH:$HADOOP_INSTALL/bin
export PATH=$PATH:$HADOOP_INSTALL/sbin
export HADOOP_MAPRED_HOME=$HADOOP_INSTALL
export HADOOP_COMMON_HOME=$HADOOP_INSTALL
export HADOOP_HDFS_HOME=$HADOOP_INSTALL
export YARN_HOME=$HADOOP_INSTALL
###end of paste

After that I opened hadoop-env.sh and pasted this ,the java home

export JAVA_HOME=/usr/lib/jvm/jdk/

Later I re-logged in and checked the hadoop version I am getting this error

"/usr/local/hadoop/bin/hadoop: line 133: /usr/lib/jvm/jdk//bin/java: No such file or directory"

I also cross verified that particular file but there is no line as such .Anybody kindly help me with this since I am new to this.

2
have you tried removing the '/' after jdk? - Vishal
which file should i remove it ? i checked the file /usr/local/hadoop/bin/hadoop also in line 133 and entire file.. but no such line exists .. where should i edit? please help - user2492854
Vishal means you to remove the '/' in the PATH of JAVA_HOME 'export JAVA_HOME=/usr/lib/jvm/jdk/' - fujy
i removed that . now i am getting the same error with the slash removed. "/usr/local/hadoop/bin/hadoop: line 133: /usr/lib/jvm/jdk/bin/java" - user2492854

2 Answers

0
votes

I found the solution.

  1. First remove / from the end /usr/lib/jvm/jdk/ in bot bashrc and hadoop-env.sh
  2. navigate to /usr/lib/jvm/jdk/bin see if it has java folder or not. If its not there then check if u have made the correct soft link. You must create a soft link for folder that has java in it so check before this command:

    $ cd /usr/lib/jvm $ ln -s java-7-openjdk-amd64 jdk

in above step as u might have seen in the tutorial change as following

$ cd /usr/lib/jvm
$ ln -s java-7-openjdk-amd64/ jdk

the 7 here is dependent on verion of jdk u have so check that and change accordingly. I have jdk 6 so i changed for java-6-**

hope it works

0
votes

This is error due to $JAVA_HOME variable. Change this variable path. you will be free from the error.

go to .bashrc using this command

vim ~/.bashrc 

Change the JAVA_HOME variable

 export JAVA_HOME=/usr/lib/jvm/jdk
 export PATH=PATH:$PATH/bin

if you have jdk 8 then replace jdk with java-8-oracle .

 export JAVA_HOME=/usr/lib/jvm/java-8-oracle
 export PATH=PATH:$PATH/bin 

restart you terminal and check the java command first, then hadoop command.