Skip to content

java_home is not read by hadoop

I installed java8 with brew install --cask adoptopenjdk/openjdk/adoptopenjdk8 but i think i messed things up,

when i type echo $JAVA_HOME it gives /usr/bin/java

when i type java -version it gives java version "1.8.0_311" Java(TM) SE Runtime Environment (build 1.8.0_311-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.311-b11, mixed mode)

when i type /usr/libexec/java_home it gives /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home

when i try to run hadoop everything starts except namenode.

when i type namenode -format after it gives this error:

ERROR: JAVA_HOME /usr/local/opt/openjdk does not exist.

My in /etc/hadoop/



ensure you JAVA_HOME is set in /etc/hadoop/conf/

in you ~/.bash_profile add the following:

export JAVA_HOME=$<your java install path>

check this post on actual install path of Java when using brew: java’s path still /usr/bin/java after brew cask install java

do this in :

JAVA_HOME=<your java install path>
export JAVA_HOME