Hadoop: Error: JAVA_HOME is not set and could not be found in Hadoop installation





After installation of Hadoop cluster in a single node, we getting while starting daemons with below error:

sreekanth@sreekanth-Inspiron-5537:~$ start-all.sh
This script is Deprecated. Instead, use start-dfs.sh and start-yarn.sh
Error: JAVA_HOME is not set and could not be found.

Error: JAVA_HOME is not set and could not be found.

How to set JAVA_HOME in Linux or Ubuntu in a simple manner while installation of the Hadoop eco-system.

Step1: Goto Java library path like below:

/usr/lib/jvm

Step 2: Open bashrc then update the JAVA_HOME environment variables simply.

export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64
export PATH=$PATH:$JAVA_HOME/bin

Step 3: After that update the hadoop env file in below path:

/home/sreekanth/Hadoop/hadoop-2.6.0/etc

then go to hadoop-env.sh file then update JAVA_HOME path into that hadoop-env.sh file like below

hadoop_env.sh

Step4: After completion of all steps then open terminal then checks all daemons using below command:



start-all.sh
sreekanth@sreekanth-Inspiron-5537:~$ start-all.sh
This script is Deprecated. Instead use start-dfs.sh and start-yarn.sh
Starting namenodes on [localhost]
sreekanth@localhost's password:
localhost: starting namenode, logging to /home/sreekanth/Hadoop/hadoop-2.6.0/logs/hadoop-sreekanth-namenode-sreekanth-Inspiron-5537.out
sreekanth@localhost's password:
localhost: starting datanode, logging to /home/sreekanth/Hadoop/hadoop-2.6.0/logs/hadoop-sreekanth-datanode-sreekanth-Inspiron-5537.out
Starting secondary namenodes [0.0.0.0]
[email protected]'s password:
0.0.0.0: starting secondarynamenode, logging to /home/sreekanth/Hadoop/hadoop-2.6.0/logs/hadoop-sreekanth-secondarynamenode-sreekanth-Inspiron-5537.out
starting yarn daemons
starting resourcemanager, logging to /home/sreekanth/Hadoop/hadoop-2.6.0/logs/yarn-sreekanth-resourcemanager-sreekanth-Inspiron-5537.out
sreekanth@localhost's password:
localhost: starting nodemanager, logging to /home/sreekanth/Hadoop/hadoop-2.6.0/logs/yarn-sreekanth-nodemanager-sreekanth-Inspiron-5537.out