mvn -version不返回版本

时间:2019-03-17 02:02:24

标签: maven

java -version运行正常:

java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)

在配置Maven之后,mvn -version没有出现。

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 'cmd' is not recognized as an internal or external command, operable program or batch file.  

1 个答案:

答案 0 :(得分:1)

来自the Maven documentation

  

确保已设置JAVA_HOME环境变量并指向您的JDK安装

例如:

$ echo $JAVA_HOME
/usr/lib/jvm/java-8-openjdk-amd64/jre

安装JDK后,通常应该配置一个JAVA_HOME环境变量。但是,您也可以手动创建它。