How to add a JRE 1.8 into Eclipse Installer JRE? - spring

I am trying deploy my Spring Boot application to Elastic Beanstalk.
The problem that I am facing right now is, my application is developed with Tomcat 9, Java 13 and Project Facet 4.0.
So when I deployed to a AWS environment, I kept getting error. After researching, I found out AWS only support Tomcat 8, Java 8 and Project Facet 3.0.
I managed to change Project Facet 4.0 to 3.0.
But I can't add Java 8 to the project.
I downloaded the JDK 8 from Oracle, and tried open jdk-8u251-macosx-x64.dmg and run JDK 8 Update 251.pkg.
The system keeps giving me error that: "JDK 8 Update 251.pkg" can't be opened because Apple cannot check it for malicious software. This software needs to be updated.
Anyone know how to fix this problem so that I can run JRE 8 on eclipse?
Here is picture the problem that I have when I deploy the app to AWS.
An internal error occurred during: Updating AWS Elastic Beanstalk environment
Here is the thread that I tried to follow but without success:
https://github.com/aws/aws-toolkit-eclipse/issues/149.

Can you elaborate where exactly are you seeing the error? While running the JDK package or while configuration the JDK within Eclipse?
Nevertheless, I suppose your main requirement is to get your Eclipse to use Java 8.
It can be done in multiple ways.
Usually you can change Java compiler level to 1.8 from Project Settings even if you're using Java 13.
If you're using Maven, you can specify compiler source and target to Java 1.8
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
Alternatively, you can download the JDK 8 zip instead of installer, unzip to any location and use that in Window > Preferences > Java > Installed JREs. Be sure to mark that one as default JRE.

Related

Set Local GraalVM JDK in Spring Boot Native

Whenever i run the gradle task bootBuildImage, GraalVM JDK is downloaded for every new project as the console states below:
Downloading from
https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-21.1.0/graalvm-ce-java11-linux-amd64-21.1.0.tar.gz
How can i set an offline GraalVM JDK for every new project?
You can use「SDKMAN」to resolve your question.
Command is:
export JAVA_HOME=$HOME/.sdkman/candidates/java/21.0.0.r8-grl
The SDKMAN is a command tool to switch the java enviroment.

Gradle in Spring Boot project not recognizing Java jdk in Path

I have a spring boot application where the gradle version is 7.0.
I had to change my openjdk 16 to openjdk 11 because I want to use keycloak with the project.
After I updated the Path, my java 11 gets recognized:
But my gradle is still stuck on the other version:
Edit: I have noticed that the error is in my build.gradle file:
Things I have tried:
restarting my pc
deleting cache folders for vscode
putting a JAVA_HOME into my path and link it and reverted it(I checked everytime with a new powershell window to make sure that it has updated and it always worked)
test another spring project (The other spring boot app does not have this gradle issue)
Anything else I can try?
I would look closely at the other spring boot app that does not have this gradle issue. VSCode has a habit of keeping cached versions of files around, but really you want the gradle files to be interrupted so it downloads new dependencies. I would look into that next, if you can't figure out what makes your other project work and this one not.

MULE 3.8.1 Hibernate 4.3.11 - org.hibernate.jpa.boot.archive.spi.ArchiveException: Could not build ClassFile

I am developing an application for MULE ESB CommunityEdition (3.8.1 version).
I have included (provided by MULE) SPRING 4.1.6.RELEASE in project.
For persistence layer I set up Hibernate 4.3.11.FINAL.
My code is based on this idea (https://www.ricston.com/blog/jpa-mule/).
So basically i have included in the project (besides MULE dependencies):
hibernate-entitymanager (4.3.11.Final)
hibernate-core (4.3.11.Final)
hibernate-jpa-2.1-api (1.0.0.Final)
spring-orm (4.1.6.RELEASE)
And everything was working perfectly fine until i started to use Java 8 API...
Whatever I do: any lambda, stream or anything I am still getting error:
org.hibernate.jpa.boot.archive.spi.ArchiveException: Could not build ClassFile
What I did until now:
tried to add org.javassist dependency (in version from 3.18.0-GA to 3-22.0-GA) - nothing happened,
tried to exclude org.reflections.0.9.9 dependency (mule is including that in some its core dependencies): also nothing happened
I spent on this about 5 hours I am really close to give it up... I really need hibernate cause this project will include many db operations
What else Can i Try to do?
Problem solved!!
I was using mvn dependency:tree to check if there are any org.javassist dependencies in project.
And there weren't...
Then I checked the folder: {mule_home}/lib/opt and there was an old version of org.javassist library!
So: I downloaded latest org.javassist jar and I put it in the {mule_home}/lib/user folder.
Now it works like a charm :)
Please check if your Anypoint Studio is pointing correct JDK.
Check below
Preference> Installed JRE >> It should have JDK 1.8 checked.

UnsupportedClassVersion - JacksonAutoDiscoverable

I'm trying to use IBM Rational Application Developer version 9.0 with WebSphere Application Server v7.0 running Java 1.6 and use JAX-RS with org.glassfish.jersey version 2.6. This is not a maven project, so I created another maven project, added the root dependencies there and built it so it pulled down all of the jars. I moved them over into my non-maven project.
When I run the project, I start the server (or try to hit a resource) I get the following error message: java.lang.UnsupportedClassVersionError: JVMCFRE003 bad major version; class=org/glassfish/jersey/jackson/internal/JacksonAutoDiscoverable, offset=6
I have a different application that successfully uses jersey deployed WAS7 on this same machine. I've compared the project and server configurations and see no major difference, particularly no difference in the Installed JRE", Execution Environments or Java Compiler Compliance Level (all using 1.6).
Even though the maven project is using jersey 2.6, I have also tried other lower jersey versions in the non-maven project to see if it's an issue with the dependencies being built for 1.7 but that doesn't seem to be the case at all.
Here is the list of dependencies I have in my library:
aopalliance-repackaged-2.2.0.jar
hk2-api-2.2.0.jar
hk2-locator-2.2.0.jar
hk2-utils-2.2.0.jar
jackson-core-asl-1.9.13.jar
jackson-jaxrs-1.9.13.jar
jackson-mapper-asl-1.9.13.jar
jackson-xc-1.9.13.jar
javassist-3.18.1-GA.jar
javax.annotation-api-1.2.jar
javax.inject-2.2.0.jar
javax.ws.rs-api-2.0.jar
jersey-client-2.6.jar
jersey-common-2.6.jar
jersey-container-servlet-core-2.6.jar
jersey-guava-2.6.jar
jersey-media-json-jackson-2.6.jar
jersey-server-2.6.jar
osgi-resource-locator-1.0.1.jar
validation-api-1.1.0.Final.jar

Can sonar build java 6 and java 7 projects on a single server?

We have a server that runs Sonar and previously only had Java 6 installed and everything worked fine. We now have a Java 7 project and are encountering the "Unsupported major.minor version 51.0" version when the Maven surefire plugin tries to analyze the project.
Is there a way to specify the Java version sonar should use for a specific project?
Java 7 is already installed on the server.
Thanks in advance!
Never mind found the JDK option under Advanced in the Jenkins configuration for the job.

Resources