Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JAVA _Home is not set in Hadoop

I am a beginner with hadoop and trying to install and run hadoop in my Ubuntu as a single node cluster. This is my JAVA_HOME in my hadoop_env.sh

# The java implementation to use.
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-i386/
export HADOOP_CONF_DIR=${HADOOP_CONF_DIR:-"/etc/hadoop"}

But when I run it the following errors come-

Starting namenodes on [localhost]
localhost: Error: JAVA_HOME is not set and could not be found.
localhost: Error: JAVA_HOME is not set and could not be found.
Starting secondary namenodes [0.0.0.0]
0.0.0.0: Error: JAVA_HOME is not set and could not be found.

How do I remove this error?

like image 721
ayushman999 Avatar asked Dec 17 '13 07:12

ayushman999


People also ask

Why JAVA_HOME is not working?

All you need to do to fix this error is edit the JAVA_HOME variable and point it to the correct directory. The JAVA_HOME environment variable must point to the root of the installation folder of a JDK. It cannot point to a sub-directory of the JDK, and it cannot point to a parent directory that contains the JDK.

How do you check JAVA_HOME is set or not?

Verify JAVA_HOMEOpen a Command Prompt window (Win⊞ + R, type cmd, hit Enter). Enter the command echo %JAVA_HOME% . This should output the path to your Java installation folder. If it doesn't, your JAVA_HOME variable was not set correctly.

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.


2 Answers

Under your HADOOP_HOME/conf directory please update the hadoop-env.sh file. It has entry to export JAVA_HOME.

Setting to appropriate JAVA_HOME in this file should solve your issue.

like image 90
Ankur Shanbhag Avatar answered Sep 28 '22 09:09

Ankur Shanbhag


Are you loading hadoop_env.sh? you may be refering to hadoop-env.sh ( dash instead of underscore - that is under conf directory)

BTW, This is a very useful guide for quick installation :

http://www.michael-noll.com/tutorials/running-hadoop-on-ubuntu-linux-single-node-cluster/

like image 23
griffon vulture Avatar answered Sep 28 '22 08:09

griffon vulture