JulianoFL JulianoFL - 2 months ago 8
Java Question

JDK Version Not in Allowed Range

I'm using Mule CE 3.7, who uses Maven to compile it's project.
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].

I already did all the solutions that i found, JAVA_HOME and PATH are configured.

If i run Java commands, they return me this:

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:

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


So all is pointing to the same Java version.
And this is happening in my Mac and 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.

Anyone have an ideia of what could it be ?

Thanks !

Answer

You probably want to use [1.7,1.9) as version range. This means it accept version between 1.7 (inclusive) until 1.9 (exclusive). Since 1.8.0_60 is bigger than 1.8, it was out of range with the previous version range. Btw, [1.8) would both include and exclude 1.8, so that shouldn't work.