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 !
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.
This error happens, when the maven JDK version and PROJECT JDK version doesn't match.
Inorder to fix that, try to find out the mvn jdk version first using
"mvn --version"
Then set the desired JDK version using set JAVA_HOME="c:\jdk_location_here". If you re-run the "mvn --version". You will see the updated JDK Version there.Now try to run your build.
Long term: Set the JAVA_HOME in environment variables.
The problem is that Mule is not compatible yet with JDK 1.8, i need to use JDK 1.7
I should have read the requeriments.
Related
My OS is Windows 10. I had an error when starting the .\artemis in the Windows PowerShell. It said:
Warning: JAVA_HOME environment variable is not set.
I already setting the JAVA_HOME's path at C:\Program Files\Java\jdk-19\bin. This is the result for echo %JAVA_HOME%:
C:\Program Files\Java\jdk-19\
I tried to test the mvn -v:
Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)
Maven home: C:\apache-maven-3.8.1\bin\..
Java version: 19.0.1, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk-19
Default locale: en_US, platform encoding: UTF-8
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
(it should not be shown if the JAVA_HOME is not set tho)
I tried the java -version:
java version "19.0.1" 2022-10-18
Java(TM) SE Runtime Environment (build 19.0.1+10-21)
Java HotSpot(TM) 64-Bit Server VM (build 19.0.1+10-21, mixed mode, sharing)
The javac -version:
javac 19.0.1
Can someone explain how to fix it?
I forgot to mention it
when I use git bash to run ./artemis the result is
./artemis: line 93: C:\Program Files\Java\jdk-19;/bin/java: No such file or directory
Install and set Java SDK 11 as JAVA_HOME.
Most applications will not work with SDK 18 or higher.
Artemis notes:
Note on Java versions: The old v17.0.1 version of the Artemis software required Java version 1.8 to run. All recent releases from v18.0.0 onwards require a minimum of Java 9 and ideally Java 11. This must be installed first.
Extracted from http://sanger-pathogens.github.io/Artemis/
Did you try using the short name? It’s been some time since I used Windows but
if I recall correctly I used to use PROGRA~1 instead of "Program files".
Immediately after I upgraded my Mac from maven 3.6.0 to 3.6.3 with homebrew, I was no longer able to build my maven project. I've been through torrents of version dependency problems, etc, but I'm hoping to avoid stepping through any more of that stuff than I need to. And before I continue, I wanted to bounce this off of you guys to see if it indicates anything ominous, or if it's ops normal (since I've never paid too much attention to it in the past.) In question is the variance in java version numbers between mvn --version and java -version, i.e., 1.8.0_191 vs 14.0.1:
$ java -version java version "1.8.0_191" Java(TM) SE Runtime
Environment (build 1.8.0_191-b12) Java HotSpot(TM) 64-Bit Server VM
(build 25.191-b12, mixed mode)
mvn --version Apache Maven 3.6.3
(cecedd343002696d0abb50b32b541b8a6ba2883f) Maven home:
/usr/local/Cellar/maven/3.6.3_1/libexec Java version: 14.0.1, vendor:
N/A, runtime:
/usr/local/Cellar/openjdk/14.0.1/libexec/openjdk.jdk/Contents/Home
Default locale: en_US, platform encoding: UTF-8 OS name: "mac os x",
version: "10.15.6", arch: "x86_64", family: "mac"
Thanks in advance!
Turns out my JAVA_HOME variable somehow evaporated in the homebrew upgrade. Once I set that, all 12 million problems disappeared instantly. Thanks for the comment khmarbaise!
Given the following:
> mvn clean compile
...
[ERROR] Failure executing javac, but could not parse the error:
/bin/sh: c:/progra~1/java/jdk1.6.0_24/bin/javac: No such file or directory
checked that my mvn and java versions were correct:
$mvn -version
Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T07:57:37-04:00)
Maven home: /Users/kevin/Downloads/apache-maven-3.3.3
Java version: 1.8.0_51, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.10.4", arch: "x86_64", family: "mac"
$java -version
java version "1.8.0_51"
Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)
Unsure of a problem with my brew-installed mvn, I removed it and downloaded mvn-...bin.zip from Apache. Then I set my PATH, verified that mvn -version and java -version spit out the same versions. But, I'm still having the same problem.
I looked at the top 3 (from search) StackOverflow results, but have not gotten any further:
Maven compilation error. Failure executing javac, but could not parse the error:javac: invalid flag: -s
Maven, Failure executing javac: Compilation failure
Compilation error: Failure executing javac, but could not parse the error
You should check your JAVA_HOME variable or pom.xml for this Windows-specific path: c:/progra~1/java/jdk1.6.0_24/bin/javac and change it to your real JDK installation path (/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/jre?).
I ran into similar issue when i started using a newer version of java.
In your case Maven is using java 6. Try setting JAVA_HOME environment variable to correct JDK version. I guess JAVA_HOME is pointing to jdk 1.6.
I have Windows 7 and I am using maven to compile my codes on command line. About 2 days ago, I had Java 6 SDK installed and that's what I was using to compile my codes. Everything was working fine; the compiled war file would start on its own after tcserver is launched. Yesterday, due to some other issue, I had to install Java 8 SDK. This is when my problem started.
It turned out that the installation of Java 8 introduced some other problem. So, I uninstalled Java 8 and rebooted. After that, I could still compile my codes. However, when I go to my tcserver manager and click Start on the process, I would get an error in the log file saying something about "Unsupported major.minor version 52.0". After some researches, it appears to be a problem with Java 8. But I did uninstall Java 8. To make sure that I have Java 6 SDK installed, I uninstalled the Java 6 SDK, re-installed it, and then re-compile my codes. That did not help and the log still shows the same error.
My mvn -v returns the followings,
Maven home: C:\installs\maven3\apache-maven-3.1.1
Java version: 1.6.0_45, vendor: Sun Microsystems Inc.
Java home: C:\installs\Java\jdk1.6.0_45\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
My echo %JAVA_HOME% returns the followings,
C:\installs\Java\jdk1.6.0_45
My java -version returns the followings,
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)
From what I can see, the version of Java that is being used in compiling my codes appears to be 6. Why am I still getting that Hikari error? Where else do I need to fix to correct the problem?
You should do the following steps:
First delete your local maven repository (usually in /.m2/repository).
This would delete all installed jar-files (which may have been created with your JDK8)
call mvn clean (to clean all your files in the target directory
Check your %JDK_HOME% (may be it points to your JDK-8
Rebuild your project by mvn package
But:
1.6.0_45, vendor: Sun Microsystems Inc.
This is really bad out-dated. You should update at least to Java7. There are unclosed security-issues in this version.
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?
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.
Make sure that your environment (PATH) is set up to use the JDK version that you want to use for compiling. You can check this by running the following in the shell or command window where you want to run Maven:
java -version
javac -version
Make sure that both java and javac are pointing to the correct version. It's possible that you have a 1.7 JRE (which does not include the compiler) and a 1.6 JDK (which includes the compiler) and the wrong one is being used.
If necessary, adjust your JAVA_HOME and PATH environment variables.
Just noticed that you're on CentOS - it's possible that java and javac point to different versions. Use the alternatives command to check that, see here for an example: http://wiki.centos.org/HowTos/JavaRuntimeEnvironment - you will have to check both the java and the javac command.
Check your JRE System Library in Eclipse. Does it show jdk1.6.0-24?
For me I had to right click the JRE System Library and go to Build Path -> Configure Build Path, in the Libraries tab I had to click JRE System Library and edit it. I set it to the Workspace Default JRE, which for me is jdk1.7.0_80 (not sure why it wasn't set to that already).