Joe King
Joe King

Reputation: 3021

Error: JAVA_HOME is not set and could not be found after hadoop installation

After installing hadoop 2.7.7 in standalone mode on a Raspberry Pi on a clean Raspbian Stretch Lite (plus java version 1.8.0_65), I get the following error:

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

This is despite me having this line in /etc/bash.bashrc:

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

printenv outputs the following:

...
JAVA_HOME=/usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/
....

I see lots of similar questions, but the answers seem to be that either the export is commented out by mistake, or to put this in hadoop-env.sh - however I don't seem to have this file.

I am trying to follow the instructions here, and all is well, until:

Start, stop and list running services

1. $cd $HADOOP_HOME/sbin

2. $./start-dfs.sh

How can I fix this please ?

Upvotes: 0

Views: 3752

Answers (1)

Let's edit /etc/hadoop/hadoop-env.sh file and set JAVA_HOME for Hadoop. It is the path on which you didn't find hadoop-env.sh.

Open the file and find the line as bellow

export JAVA_HOME=/usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/

If the line exists and is commented out, do uncomment. Otherwise, add the line into the file. Beware not

export JAVA_HOME=${JAVA_HOME}

If the file is still not found, maybe path is different. Try to search it using,

find / -iname 'hadoop-env.sh'

Upvotes: 3

Related Questions