[Solved]Unable to start Hadoop Daemons Error: JAVA_HOME is not set and could not be found

Recently, I have installed Hadoop Single Node Cluster on Ubuntu. After that, I am trying to run the all Hadoop daemons on the terminal.



Error: JAVA_HOME is not set and could not be found

First, I checked the JPS (Java Virtual Machine Process Tool) is a  command to check all Hadoop daemons likeNamenode, Datanode, Resource manager, etc. By using below simple command on terminal

jps

It shows only 1 process then, tried to start all Hadoop daemons by using below command:

start-all.sh

After entering the above command and getting below error in the terminal:

Sreekanth@ubuntu : ~$ start-all.sh
This script is Deprecated. Instead, use start-dfs.sh and start-yarn.sh
Starting namenodes on [localhost]
localhost: Error: JAVA_HOME is not set and could not be found.
starting yarn daemons
Startting resourcemanager, logging to /home/Sreekanth/Hadoop/hadoop-2.6.0/logs/yarn-resourcemanager-ubuntu.out
localhost: Error: JAVA_HOME is not set and could not be found.

Please find below screenshot for full error:

Solution:

Here we will give simple steps to resolve the above error in a single node Hadoop cluster for Hadoop admin/developers.




Step 1: Stop all Hadoop daemons using below command:

stop-all.sh

Step 2: Open the bashrc file in using below command

nano ~/.bashrc

Step 3: Check the JAVA_HOME path is set up properly or not, in case if it is not there then set the JAVA_HOME in bashrc file.

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

Step 4: After completed the above commands then try to verify the JAVA_HOME

echo $JAVA_HOME

Once it showing JAVA_HOME and Java-related information then fine. Otherwise, we need to check, in case getting other errors. Please comment on it, we will assist you.

Conclusion:

The above steps are simple to resolve the Java error in the Hadoop Cluster for Hadoop Admins and Developers. In the Hadoop cluster, Java is mandatory prerequisites because Hadoop is developed by Java so Java is mandatory while installing Hadoop services like Hive, Pig, SQOOP, etc. Here we provided an exact solution for this issue. Java 1.7 or above versions are better for Hadoop installations.



Leave a Reply

Your email address will not be published. Required fields are marked *