简体   繁体   English

JDK版本不在允许范围内

[英]JDK Version Not in Allowed Range

I'm using Mule CE 3.7 , who uses Maven to compile it's project. 我正在使用Mule CE 3.7 ,后者使用Maven来编译其项目。 The problem is, when is compiling, he returns this error: 问题是,在编译时,他返回此错误:

[ERROR] Detected JDK Version: 1.8.0-60 is not in the allowed range [1.7,1.8]. [错误]检测到的JDK版本:1.8.0-60不在允许的范围[1.7,1.8]中。

I already did all the solutions that i found, JAVA_HOME and PATH are configured. 我已经做了发现的所有解决方案,配置了JAVA_HOME和PATH。

If i run Java commands, they return me this: 如果我运行Java命令,它们将向我返回以下内容:

MBP-de-axz:~ axz$ java -version
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

MBP-de-axz:~ axz$ javac -version
javac 1.8.0_60

MBP-de-axz:~ axz$ mvn -version
Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T08:57:37-03:00)
Maven home: /usr/local/Cellar/maven/3.3.3/libexec
Java version: 1.8.0_60, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre
Default locale: pt_BR, platform encoding: UTF-8
OS name: "mac os x", version: "10.10.1", arch: "x86_64", family: "mac"

I already configured the Pom file of my project like this: 我已经像这样配置了项目的Pom文件:

<requireJavaVersion>
     <version>[1.7,1.9)</version>
</requireJavaVersion>

So all is pointing to the same Java version. 因此,所有人都指向相同的Java版本。 And this is happening in my Mac and Windows. 这是在我的Mac和Windows中发生的。 The project only works if i change to Java 1.7, but i can use 1.7 because one of my libraries uses Java 1.8. 仅当我更改为Java 1.7时该项目才能工作,但是我可以使用1.7,因为我的一个库使用Java 1.8。

Anyone have an ideia of what could it be ? 任何人都对它有什么想法?

Thanks ! 谢谢 !

You probably want to use [1.7,1.9) as version range. 您可能要使用[1.7,1.9)作为版本范围。 This means it accept version between 1.7 (inclusive) until 1.9 (exclusive). 这意味着它接受1.7 (含)至1.9 (不含)之间的版本。 Since 1.8.0_60 is bigger than 1.8 , it was out of range with the previous version range. 由于1.8.0_60大于1.8 ,因此超出了先前版本范围。 Btw, [1.8) would both include and exclude 1.8 , so that shouldn't work. 顺便说一句, [1.8)会同时包含和排除1.8 ,所以这不起作用。

The problem is that Mule is not compatible yet with JDK 1.8, i need to use JDK 1.7 问题是Mule还不兼容JDK 1.8,我需要使用JDK 1.7

I should have read the requeriments. 我应该已经阅读了这些要求。

This error happens, when the maven JDK version and PROJECT JDK version doesn't match. 当Maven JDK版本和PROJECT JDK版本不匹配时,会发生此错误。

Inorder to fix that, try to find out the mvn jdk version first using 为了解决该问题,请尝试首先使用以下命令找出mvn jdk版本

"mvn --version"

Then set the desired JDK version using set JAVA_HOME="c:\\jdk_location_here" . 然后使用set JAVA_HOME="c:\\jdk_location_here"设置所需的JDK版本。 If you re-run the "mvn --version" . 如果重新运行"mvn --version" You will see the updated JDK Version there.Now try to run your build. 您将在此处看到更新的JDK版本。现在尝试运行您的构建。

Long term: Set the JAVA_HOME in environment variables. 长期:在环境变量中设置JAVA_HOME。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM