Skip to content
Advertisement

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 start-all.sh it gives this error:

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

My hadoop-env.sh in /etc/hadoop/

Advertisement

Answer

ensure you JAVA_HOME is set in /etc/hadoop/conf/hadoop-env.sh.

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 hadoop-env.sh :

JAVA_HOME=<your java install path>
export JAVA_HOME
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement