哪个是 Spring 4 支持的最低 Java 版本
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21120437/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Which is the minimum supported Java Version of Spring 4
提问by Christian Rockrohr
I recently one of my projects to Spring 4.0.0.RELEASE
我最近将我的一个项目发布到 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)
将项目部署到我的登台环境后,我发现了一个带有以下消息的异常:在 offset=6 处的主要版本错误。我的假设是,Sping 4 不适用于 Java 6(我被迫这样做,因为我无法在系统上更改它)
(Actually I even was not aware, that a JAR is depending on the Java Version)
(实际上我什至不知道,JAR 取决于 Java 版本)
采纳答案by MariuszS
Christian RockrohrMy assumption is, that Sping 4 is not working with Java 6
Christian Rockrohr我的假设是,Sping 4 不适用于 Java 6
This is wrong assumption.
这是错误的假设。
Spring requires JVM 1.6 or higher, as of Spring 4.0. *****
从 Spring 4.0 开始,Spring 需要 JVM 1.6 或更高版本。*****
Java 8 (as well as 6 and 7)
Java 8(以及 6 和 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.
Spring 仍然与旧版本的 Java 和 JDK 兼容:具体而言,Java SE 6(具体来说,相当于 2008 年末发布的 JDK 6 更新 10 的最低级别)及更高版本仍受完全支持。但是,对于新开始的基于 Spring 4 的开发项目,我们建议使用 Java 7 或 8。
Read also:
另请阅读:
This look like running a Spring 4 application with JDK 1.5.
这看起来像是使用 JDK 1.5 运行 Spring 4 应用程序。
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.
Christian Rockrohr:Indeet,我的 AS400 上安装了 Java 1.5,它不是 Java 1.6。这就是为什么 Spring 不起作用的原因。我刚刚回到 Spring 3.1.0.RELEASE 并且它起作用了。
*****) http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/core/JdkVersion.html
*****) http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/core/JdkVersion.html
回答by Ralph
An exception like this
像这样的例外
java.lang.UnsupportedClassVersionError: bad major version at offset=6
java.lang.UnsupportedClassVersionError:offset=6 处的主要版本错误
Will occure when code is compiled for java version 6, but one try to run it with java 5.
当为 Java 版本 6 编译代码时会发生,但尝试使用 Java 5 运行它。
回答by user3434043
jdk 1.6 update-18 or above(latest in 1.6 jdk is jdk-6u-45) versions will support spring 4.0
jdk 1.6 update-18 或以上(最新的1.6 jdk 是jdk-6u-45)版本将支持spring 4.0