检测到的 JDK 版本:1.6.0-24 不在允许的 1.7 范围内

2022-01-13 00:00:00 centos java maven

当我运行命令时

mvn clean package

我收到错误:

Detected JDK Version: 1.6.0-24 is not in the allowed range 1.7.

如何解决上述错误?我试图检查 jdk 版本是否已安装并得到了这个

How to fix the above error? I tried to check jdk version isntalled and got this

java version "1.7.0_03"
Java(TM) SE Runtime Environment (build 1.7.0_03-b04)
Java HotSpot(TM) 64-Bit Server VM (build 22.1-b02, mixed mode)

如何解决这个问题?

推荐答案

一般在执行 mvn -v 时可能会看到类似

Normally when execute the mvn -v you may see something like

Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 
                    2013-02-19 20:51:28+0700)
Maven home: C:Java.ApplicationApacheapache-maven-3.0.5in..
Java version: 1.7.0_15, vendor: Oracle Corporation
Java home: C:Java.ApplicationSunJavajdk1.7.0_15jre
Default locale: en_US, platform encoding: MS874
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"

如果结果指向 JDK 版本:1.6.0-24 或与您期望的不同.请简单地将 JAVA_HOME 设置为您的 JDK Version: 1.7.0_03.

If the result point to the JDK Version: 1.6.0-24 or other than your expect. Please simply set the JAVA_HOME to your JDK Version: 1.7.0_03 instead.

我希望这会有所帮助.

相关文章