Hadoop is not able to find JAVA_HOME properly
- by Shekhar
I am trying to run hadoop my Ubuntu OS. I have set JAVA_HOME variable in ~/.bashrc file to /usr/lib/jvm/jdk1.7.0_01/ but when I run hadoop namenode -format command it fails with following errors :
shekhar@ubuntu:/usr$ hadoop namenode -format
Warning: $HADOOP_HOME is deprecated.
/host/Shekhar/Softwares/hadoop-1.0.0/bin/hadoop: line 321: /usr/jdk1.7.0_01/bin/java: No such file or directory
/host/Shekhar/Softwares/hadoop-1.0.0/bin/hadoop: line 387: /usr/jdk1.7.0_01/bin/java: No such file or directory
hadoop tries to locate java command at /usr/jdk1.7.0_01/bin/ path. Clearly somehow it missed /lib/jvm folder. I am not able to understand why and how this is happening.
my echo $PATH command gives following output :
shekhar@ubuntu:/usr$ echo $PATH
/usr/lib/jvm/jdk1.7.0_01/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib/jvm/jdk1.7.0_01/bin:/host/Shekhar/Softwares/hadoop-1.0.0/bin
If I run which java command I get following output :
shekhar@ubuntu:/usr$ which java
/usr/lib/jvm/jdk1.7.0_01/bin/java
and echo $JAVA_HOME returns following output :
shekhar@ubuntu:/usr$ echo $JAVA_HOME
/usr/lib/jvm/jdk1.7.0_01
I would like to know why hadoop is taking JAVA_HOME path incorrectly. Please help...