Unsupported major.minor version 52.0 on HikariDataSource - java

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.

Related

Warning: JAVA_HOME environment variable is not set

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".

Java project with Visual Studio Code on raspberry pi (Java Language Server icon keeps spinning)

I'm new to Raspian as well as the Raspberry Pi and just got a Raspberry Pi 400. I would like to use it to work on some small Java projects. To do this, I would like to use Visual Studio Code as an IDE. However, once I create a new Java project in VS Code, the icon in the bottom right hand corner indicating the "Java Server Status" simply keeps spinning, so that I cannot actually run the main method.
I roughly followed the directions given here by
Installing VS Code using sudo apt install code
Installing Maven using sudo apt install maven
Installing the "Extension Pack for Java" in VS Code
Creating a new Maven project in VS Code (using maven-archetype-quickstart with version 1.4).
I then encounter the problem mentioned above and cannot even run the "Hello World" demo.
When I run mvn -v, I get:
Apache Maven 3.6.0
Maven home: usr/share/maven
Java version: 11.0.12, vendor: Raspian, runtime: /usr/lib/jvm/java-11-openjdk-armhf
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.10.63-v7l+", arch: "arm", family: "unix"
while java -version returns:
openjdk version "11.0.12" 2021-07-20
OpenJDK Runtime Environment (build 11.0.12+7.post-Raspian-2deb10u1)
OpenJDK Server VM (build 11.0.12+7.post.Raspian-2deb10u1, mixed mode)
I also tried to set the JAVA_HOME variable as described here and to manually add java.home as well as JAVA_HOME to the "settings.json" file found in /home/pi/.config/Code/User, but to no avail.
Any help is much appreciated!

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 !
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.

Unable to analyse project with SonarQube

I want to analyse project with SonarQube
while doing this it gives me a error message saying
Error during execution of Sonar
Error status [command: C:\Program Files (x86)\Java\jdk1.6.0_18\jre\bin\java.exe -cp C:\Users\qfrg\AppData\Local\Temp\sonar-runner-impl7722306846094038579.jar org.sonar.runner.impl.BatchLauncherMain C:\Users\qfrg\AppData\Local\Temp\sonar-project6654886318444556353.properties]: 1
In the console log i see this :
Caused by: org.sonar.api.utils.SonarException: The plugin javascript is not supported with Java 1.6.0_18
Caused by: java.lang.UnsupportedClassVersionError: org/sonar/plugins/javascript/JavaScriptPlugin : Unsupported major.minor version 51.0
I installed plugins for findbugs, checkstyle, PMD and M2Eclipse successfully before installing sonarqube, but after installing sonarqube, when i tried to add them again they say that
Unable to connect to repository http://eclipse-cs.sourceforge.net/update/compositeContent.xml
Connection to http://eclipse-cs.sourceforge.net refused
Please find my version and plugin details:
java:
java version "1.6.0_18"
Java(TM) SE Runtime Environment (build 1.6.0_18-b07)
Java HotSpot(TM) Client VM (build 16.0-b13, mixed mode, sharing)
maven:
Apache Maven 3.0.3 (r1075438; 2011-02-28 23:01:09+0530)
Maven home: C:\dev\apache-maven-3.0.3-bin
Java version: 1.6.0_18, vendor: Sun Microsystems Inc.
Java home: C:\Program Files (x86)\Java\jdk1.6.0_18\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"
and
SonarQube Server 4.5.4
Eclipse : Kepler Service Release 2
And i am using TFS as source control
Where am i going wrong ?
Is this the problem with java version ? As, I have seen in some sites that it worked for them when upgraded to 1.7 version of java
Any help greatly appreciated
As mentionned in the Requirements documentation page, Java 7 at least is required to run SonarQube server and SonarQube analyses.
You are using a Java 6 virtual machine, this is why you get those error messages.

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

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).

Categories