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
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 :( :(
Change the JAVA_HOME
variable in conf/hadoop-env.sh
export JAVA_HOME=/etc/local/java/<jdk folder>
echo "export JAVA_HOME=/usr/lib/java" >> $HADOOP_HOME/etc/hadoop/hadoop-env.sh
Notice: Do not use export JAVA_HOME=${JAVA_HOME}
!
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>
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.
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