Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which is the minimum supported Java Version of Spring 4

Tags:

java

spring

I recently one of my projects to Spring 4.0.0.RELEASE

After deploying the project to my staging environment, I recognized an Exception with the following Message: bad major version at offset=6. My assumption is, that Sping 4 is not working with Java 6 (which I am forced to, because I can not change it on the system)

(Actually I even was not aware, that a JAR is depending on the Java Version)

like image 293
Christian Rockrohr Avatar asked Jan 14 '14 17:01

Christian Rockrohr


People also ask

What is the minimum Java version for spring boot?

System Requirements. Spring Boot 2.7. 2 requires Java 8 and is compatible up to and including Java 18.

What version of Java does Spring support?

Spring Framework 4.3 will be supported on Java versions up to Java 8. Spring Framework 5.0 had initial support for Java 9, and Spring Framework 5.1 requires JDK 8 and officially supports Java 11.

Which version of Spring is compatible with Java 6?

As you may have guessed, we're making extensive use of such arrangements within the Spring Framework codebase! The bottom line is that the choice is yours: We carefully designed Spring Framework 4. x to be naturally compatible with Java 6, 7 and 8, with the same Spring jars and no special setup steps.

Which hibernate version is compatible with Spring 4?

Note that Hibernate 4.3 is a JPA 2.1 provider and therefore only supported as of Spring Framework 4.0.


2 Answers

Christian Rockrohr My assumption is, that Sping 4 is not working with Java 6

This is wrong assumption.

Spring requires JVM 1.6 or higher, as of Spring 4.0. *****

Java 8 (as well as 6 and 7)

Spring remains compatible with older versions of Java and the JDK: Concretely, Java SE 6 (specifically, a minimum level equivalent to JDK 6 update 10, as released in late 2008) and above are still fully supported. However, for newly started development projects based on Spring 4, we recommend the use of Java 7 or 8.

Read also:

  • java.lang.UnsupportedClassVersionError: bad major version at offset=6

This look like running a Spring 4 application with JDK 1.5.

Confirmed:

Christian Rockrohr: Indeet, there is Java 1.5 installed on my AS400, it is not Java 1.6. That's is the reason, why Spring did not work. I just returned to Spring 3.1.0.RELEASE and it worked.

*****) http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/core/JdkVersion.html

like image 189
MariuszS Avatar answered Oct 14 '22 02:10

MariuszS


jdk 1.6 update-18 or above(latest in 1.6 jdk is jdk-6u-45) versions will support spring 4.0

like image 36
user3434043 Avatar answered Oct 14 '22 01:10

user3434043