Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JAVA_HOME not setting

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.
like image 973
Vardan Gupta Avatar asked Feb 08 '12 11:02

Vardan Gupta


People also ask

How do I set my JAVA_HOME?

To set JAVA_HOME, do the following: Right click My Computer and select Properties. On the Advanced tab, select Environment Variables, and then edit JAVA_HOME to point to where the JDK software is located, for example, C:\Program Files\Java\jdk1. 6.0_02.

Should I set JAVA_HOME to JDK or JRE?

If you're doing any sort of development, or building with Maven or Ant, you need to point to the JDK (Java Development Kit) where utilities such as javac (the Java Compiler) reside. Otherwise, you can point to the JRE (Java Runtime Environment). The JDK contains everything the JRE has and more.

Do I need to add JAVA_HOME to path?

To compile and run Java applications successfully you'll need to setup the JAVA_HOME and PATH environment variables.


1 Answers

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

like image 170
Eugene Retunsky Avatar answered Sep 21 '22 22:09

Eugene Retunsky