Hadoop: «ERROR : JAVA_HOME is not set»

前端 未结 12 1786
借酒劲吻你
借酒劲吻你 2020-12-13 17:13

I\'m trying to install Hadoop on Ubuntu 11.10. I set the JAVA_HOME variable in the file conf/hadoop-env.sh to:

# export JAVA_HOME=         


        
相关标签:
12条回答
  • 2020-12-13 18:00

    I solved this in my env, without modify hadoop-env.sh

    You'd be better using /bin/bash as default shell not /bin/sh

    Check these before:

    1. You have already config java and env (success echo $JAVA_HOME)
    2. right config hadoop

    echo $SHELL in every node, check if print /bin/bash if not, vi /etc/passwd, add /bin/bash at tail of your username ref

    Changing default shell in Linux

    https://blog.csdn.net/whitehack/article/details/51705889

    0 讨论(0)
  • 2020-12-13 18:06

    You can add in your .bashrc file:

    export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::")
    

    and it will dynamically change when you update your packages.

    0 讨论(0)
  • 2020-12-13 18:06
    • hadoop ERROR : JAVA_HOME is not set

    Above error is because of the space in between two words.

    Eg: Java located in C:\Program Files\Java --> Space in between Program and files would cause the above problem. If you remove the space, it would not show any error.

    0 讨论(0)
  • 2020-12-13 18:08

    Make sure that you have removed the comment tag and changed your JAVA_HOME in the hadoop-env.sh as well as the appropriate .bashrc and/or .profile:

    # export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk
    

    should be

    export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk
    

    You can set your JAVA_HOME and PATH for all users (make sure you haven't previously set this to the wrong path) in /etc/profile.

    Also, don't forget to activate the new change by logging-out/in or by executing source /etc/profile.

    0 讨论(0)
  • I tried changing /etc/environment:

    JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64"

    on the slave node, it works.

    0 讨论(0)
  • 2020-12-13 18:11

    Type echo $JAVA_HOME in your terminal to be sure your JAVA_HOME is set.

    You can also type java -version to know what version of java you are actually using.

    By the way, reading your description it seems your actually writing

    export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk
    

    in the file conf/hadoop-env.sh, you should write it in your terminal or in ~/.bashrc or ~/.profile then type source < path to modified file >.

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