JAVA_HOME not setting

Vardan Gupta picture Vardan Gupta · Feb 8, 2012 · Viewed 24.7k times · Source

While working on Hadoop Implementation in Pseudo-Distributed Operation, I found following exception of JAVA_HOME variable not setting, but When I tried to echo it, it was set.

Variable is preset in conf/hadoop-env.sh (edited export JAVA_HOME=/usr/lib/jvm/java-6-sun), bash.bashrc.

vardan@vardan-HP-G62-Notebook-PC:~/hadoop-0.20.203.0$ echo $JAVA_HOME
/usr/lib/jvm/java-6-sun
vardan@vardan-HP-G62-Notebook-PC:~/hadoop-0.20.203.0$ bin/start-all.sh
starting namenode, logging to /home/vardan/hadoop-0.20.203.0/bin/../logs/hadoop-vardan-namenode-vardan-HP-G62-Notebook-PC.out
localhost: starting datanode, logging to /home/vardan/hadoop-0.20.203.0/bin/../logs/hadoop-vardan-datanode-vardan-HP-G62-Notebook-PC.out
localhost: Error: JAVA_HOME is not set. 
localhost: starting secondarynamenode, logging to /home/vardan/hadoop-0.20.203.0/bin/../logs/hadoop-vardan-secondarynamenode-vardan-HP-G62-Notebook-PC.out
localhost: Error: JAVA_HOME is not set. 
starting jobtracker, logging to /home/vardan/hadoop-0.20.203.0/bin/../logs/hadoop-vardan-jobtracker-vardan-HP-G62-Notebook-PC.out 
localhost: starting tasktracker, logging to /home/vardan/hadoop-0.20.203.0/bin/../logs/hadoop-vardan-tasktracker-vardan-HP-G62-Notebook-PC.out
localhost: Error: JAVA_HOME is not set.

Answer

Eugene Retunsky picture Eugene Retunsky · May 27, 2012

I simply added to the ./conf/hadoop-env.sh this line:

# The java implementation to use.  Required.
export JAVA_HOME=/usr/java/latest

and it helped