When Spark starts, report JAVA_HOME is not set


1. Error content

An error is reported when Spark starts:

hadoop104:   JAVA_HOME is not set

insert image description here

2. Solution

Solution:

Open the launch configuration file

cd /opt/module/spark-standalone/sbin/
vim spark-config.sh

Configure Java environment variables

#JAVA_HOME
export JAVA_HOME=/usr/local/java/jdk1.8.0_181
export PATH=$JAVA_HOME/bin:$PATH

Please add a picture description

3. Start the Spark cluster again

Start the Spark cluster

./sbin/start-all.sh 

insert image description here

Guess you like

Origin blog.csdn.net/weixin_44624117/article/details/132502986