检测到的JDK版本:1.6.0-24不在允许的范围内1.7(Detected JDK Version: 1.6.0-24 is not in the allowed range 1.7)

当我运行命令时

mvn clean package

我收到错误:

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

如何解决上述错误? 我试图检查jdk版本isntalled并得到这个

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)

如何解决这个问题?

When I ran the command

mvn clean package

I am getting error:

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

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)

how to fix this?

最满意答案

通常在执行mvn -v你可能会看到类似的东西

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

如果结果指向JDK Version: 1.6.0-24或其他预期。 请简单地将JAVA_HOME为JDK Version: 1.7.0_03 。

我希望这可能会有所帮助。

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.Application\Apache\apache-maven-3.0.5\bin\.. Java version: 1.7.0_15, vendor: Oracle Corporation Java home: C:\Java.Application\Sun\Java\jdk1.7.0_15\jre Default locale: en_US, platform encoding: MS874 OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"

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.

I hope this may help.

更多推荐