配置Maven时出现错误The JAVA_HOME environment variable is not defined correctly

配置Maven出现JAVA_HOME错误

错误提示如下:

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

删除掉原来配置过的JAVA_HOME,重新配置jdk
ctrl+R进入cmd中输入mvn -version 或 mvn -v(mvn的后面有一个空格)进行验证,出现以下信息,则说明Maven配置成功

C:\Users\LENOVO>mvn -v
Apache Maven 3.6.1 (d66c9c0b3152b2e69ee9bac180bb8fcc8e6af555; 2019-04-05T03:00:29+08:00)
Maven home: E:\Eclipse\Maven\apache-maven-3.6.1\bin\..
Java version: 1.8.0_131, vendor: Oracle Corporation, runtime: E:\Eclipse\jdk1.8.0_131\jre
Default locale: zh_CN, platform encoding: GBK
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

你可能感兴趣的:(Maven配置错误,The,JAVA_HOME,environment,variable)