Working With Hadoop: localhost: Error: JAVA_HOME is not set

后端 未结 11 626
天命终不由人
天命终不由人 2020-12-13 02:19

I\'m working with Ubuntu 12.04 LTS.

I\'m going through the hadoop quickstart manual to make a pseudo-distributed operation. It seems simple and straightforward (eas

相关标签:
11条回答
  • 2020-12-13 03:01

    extract from etc/hadoop/hadoop-env.sh

    The only required environment variable is JAVA_HOME. All others are optional. When running a distributed configuration it is best to set JAVA_HOME in this file, so that it is correctly defined on remote nodes.

    This means its better and advised to set JAVA_HOME here.. even though the existing definition reads the JAVA_HOME variable. Perhaps its not getting the value of JAVA_HOME from previously set value... standard apache manual does not tell this :( :(

    0 讨论(0)
  • 2020-12-13 03:05

    Change the JAVA_HOME variable in conf/hadoop-env.sh

    export JAVA_HOME=/etc/local/java/<jdk folder>
    
    0 讨论(0)
  • 2020-12-13 03:05
    echo "export JAVA_HOME=/usr/lib/java" >> $HADOOP_HOME/etc/hadoop/hadoop-env.sh
    

    Notice: Do not use export JAVA_HOME=${JAVA_HOME} !

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

    I am using hadoop 1.1, and faced the same problem.

    I got it solved through changing JAVA_HOME variable in /etc/hadoop/hadoop-env.sh as:

    export JAVA_HOME=/usr/lib/jvm/<jdk folder>
    
    0 讨论(0)
  • 2020-12-13 03:10

    This error is coming from Line 180

    if [[ -z $JAVA_HOME ]]; then
       echo "Error: JAVA_HOME is not set and could not be found." 1>&2
       exit 1
    fi
    

    in libexec/hadoop-config.sh.

    Try echo $JAVA_HOME in that script. If it doesn't recognize,

    Find your JAVA_HOME using this:

    $(readlink -f /usr/bin/javac | sed "s:/bin/javac::")

    and replace the line

    export JAVA_HOME=${JAVA_HOME} in /etc/hadoop/hadoop-env.sh with JAVA_HOME you got from above command.

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

    I also had faced the similar problem in hadoop 1.1 I had not noticed that the JAVA_HOME was commented in: hadoop/conf/hadoop-env.sh

    It was

    /#JAVA_HOME=/usr/lib/jvm/java-6-oracle
    

    Had to change it to

    JAVA_HOME=/usr/lib/jvm/java-6-oracle
    
    0 讨论(0)
提交回复
热议问题