openjdk配置JAVA_HOME

今天安装Maven,发现提示:

The JAVA_HOME environment variable is not defined correctly
This environment variable is needed to run this program
NB: JAVA_HOME should point to a JDK not a JRE
[root@oracle apache-maven-3.5.4]# echo $JAVA_HOME
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-8.b10.el7_5.x86_64

原来安装java-1.8.0-openjdk.x86_64,这个只是运行环境,开发环境需要安装java-1.8.0-openjdk-devel.x86_64,这个才包含JAVA_HOME/bin目录。