hadoop运行start-dfs.sh时,报master: ERROR: JAVA_HOME is not set and could not be found.

我已经在hadoop _ env.sh中设置了JAVA _ HOME的绝对路径,还是会报错

###
# Generic settings for HADOOP
###

# Technically, the only required environment variable is JAVA_HOME.
# All others are optional.  However, the defaults are probably not
# preferred.  Many sites configure these options outside of Hadoop,
# such as in /etc/profile.d

# The java implementation to use. By default, this environment
# variable is REQUIRED on ALL platforms except OS X!
export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_211

我的虚拟机VMware Workstation14.0.0  linux是ubuntu 12.04 desktop amd64
jdk是jdk-1.8.0_211 hadoop是 3.1.2

你可以试试修改hadoop-env.sh里面的JAVA_HOME,将这一行前面的#删去就可以了