JAVA _Home is not set in Hadoop

前端 未结 8 1193
耶瑟儿~
耶瑟儿~ 2021-01-05 00:03

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          


        
相关标签:
8条回答
  • 2021-01-05 00:40

    I'm using hadoop 2.8.0. Even though I exported JAVA_HOME (I put it in .bashrc), I still caught this error while trying to run start-dfs.sh.

    user@host:/opt/hadoop-2.8.0 $ echo $JAVA_HOME
    <path_to_java>
    user@host:/opt/hadoop-2.8.0 $ $JAVA_HOME/bin/java -version
    java version "1.8.0_65"
    ...
    user@host:/opt/hadoop-2.8.0 $ sbin/start-dfs.sh
    ...
    Starting namenodes on []
    localhost: Error: JAVA_HOME is not set and could not be found.
    localhost: Error: JAVA_HOME is not set and could not be found.
    

    The only way I could get it to run was to add JAVA_HOME=path_to_java to etc/hadoop/hadoop-env.sh and then source it:

    :/opt/hadoop-2.8.0 $ grep JAVA_HOME etc/hadoop/hadoop-env.sh
    #export JAVA_HOME=${JAVA_HOME}
    export JAVA_HOME=path_to_java
    user@host:/opt/hadoop-2.8.0 $ source etc/hadoop/hadoop-env.sh
    

    Maybe that (sourcing hadoop-env.sh) was implied in the posts above. Just thought someone should say it out loud. Now it runs. I've encountered other issues (due, I suspect, to the limited resources on the server I'm using), but at least I got past this one.

    0 讨论(0)
  • 2021-01-05 00:42

    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.

    0 讨论(0)
提交回复
热议问题