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

ERROR: JAVA_ HOME is not set and could not be found.

Background

    attempting to operate on HDFS namenode as root, but there is no HDFS_ NAMENODE_ USER defined. Aborting

Solution

    in $Hadoop_ Add the location of the JDK in the home/etc/Hadoop directory. Note that it is distributed to other machines in the cluster

    export JAVA_HOME=/opt/module/jdk1.8
    

Read More: