7

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)

Christian Rockrohr
  • 1,045
  • 1
  • 14
  • 29

3 Answers3

13

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:

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

Community
  • 1
  • 1
MariuszS
  • 30,646
  • 12
  • 114
  • 155
  • 1
    Now, did Spring 3.x work with Java 1.5? My guess is OP's environment only has Java 5, rather than Java 6. – Thorn G Jan 14 '14 at 18:07
  • Yes, Spring 3 requires Java 1.5+. You are right, it is possible that OP uses JDK 1.5. – MariuszS Jan 14 '14 at 18:11
  • @MariuszS I do not understand how the statement "Note that Spring requires JVM 1.6 or higher, as of Spring 4.0." from the java doc, lead to your statement "Spring 3.2 based applications need to be compiled with a maximum of Java 7 as the target" – Ralph Jan 14 '14 at 19:45
  • @Ralph *Spring 3.2 based applications need to be compiled with a maximum of Java 7 as the target* to work with JDK 1.8 - but this is not important here - removed. – MariuszS Jan 14 '14 at 20:15
  • Hi every one, thank you fpr all your comments and good hints. 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. – Christian Rockrohr Jan 15 '14 at 14:09
1

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

0

An exception like this

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

Will occure when code is compiled for java version 6, but one try to run it with java 5.

Ralph
  • 118,862
  • 56
  • 287
  • 383