与 Java 7 兼容的旧项目

发布于 2024-11-27 02:06:05 字数 54 浏览 1 评论 0 原文

我的旧项目使用Java 6(1.6),我不知道当我更新(Java 7)时,它们可以正常运行吗?

My old projects use Java 6 (1.6), and I don't know when I update (Java 7), they can run fine ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

北方的韩爷 2024-12-04 02:06:05

有一个官方列表,列出了 java 6 和Oracle 的 java 7(包括公共 API 中二进制和源代码级不兼容性的描述)。

您还可以查看Java API Tracker项目中API更改的独立分析:http ://abi-laboratory.pro/java/tracker/timeline/jre/

该报告由 japi-compliance-checker 工具。

输入图片此处描述

There is an official list of known incompatibilities between java 6 and java 7 from Oracle (including descriptions of both binary and source-level incompatibilities in public APIs).

Also you can look at the independent analysis of API changes in the Java API Tracker project: http://abi-laboratory.pro/java/tracker/timeline/jre/

The report is generated by the japi-compliance-checker tool.

enter image description here

时光无声 2024-12-04 02:06:05

他们应该这样做,是的。 Java 具有相当强大的向后兼容性历史。但是,如果这些项目在任何方面重要,您仍然应该在部署到任何类似生产环境的地方之前执行彻底的测试。

They should do, yes. Java has a reasonably strong history of backward compatibility. However, if these are in any way important projects you should still perform a thorough test pass before deploying anywhere production-like.

谎言 2024-12-04 02:06:05

不应该有任何兼容性差异,因为 JVM 基本相同。然而,现在还处于早期阶段,因此可能存在细微的差异,从而导致人们尚未意识到的问题。

例如,Eclipse 在Windows 上查看java.exe 中的供应商,并为不同的供应商设置不同的命令行参数。 Java 6 update 22 存在问题,因为 Oracle 想要将其从“Sun”更改为“Oracle”。我相信这已被更改,因此在 Java 7 中它是“Oracle”(但在 Java 6 中仍然是“Sun”)。

我的观点是,如果您编写通用 Java 代码,那么就不会有问题。但是,如果您做的事情有点不寻常,您可能需要重新测试您的应用程序。

There shouldn't be any compatibility differences as the JVM is basically the same. However it is early days so there may be subtle differences which cause a problem which people are not yet aware of.

e.g. Eclipse looks at the Supplier in the java.exe on Windows and sets the command line arguments differently for different suppliers. It has a problem with Java 6 update 22 because Oracle wanted to change it from "Sun" to "Oracle". I believe this has been changed so it is "Oracle" in Java 7 (but still "Sun" for Java 6)

My point being, that if you write generic Java code, you shouldn't have a problem. However, if you are doing something a bit unusual, you are likely to need to re-test your application.

疏忽 2024-12-04 02:06:05

正如已经指出的,向后兼容性是新 Java 版本中非常重要的一个方面,因此一般来说,切换到较新的 Java 版本应该不会出现问题。然而,在这种情况下,Java 7 在新的热点编译器优化中似乎存在一些错误。 Apache 软件基金会已发出警告,称其产品 Lucene 和 Solr 受到这些错误的影响。

http://lucene.apache.org/#28+July+2011+-+WARNING%3A+Index+corruption+and+crashes+in+Apache+Lucene+Core+%2F+Apache+Solr +with+Java+7

可以通过使用 -XX:-UseLoopPredicate 启动 java 来关闭受影响的循环优化。

As was already stated backward compatibility is a very important aspect in new Java releases, so in general there should be no problems in switching to a newer Java version. In this case, however, Java 7 seems to have a few bugs in the new hotspot compiler optimizations. The Apache Software Foundation has issued a warning that their products Lucene and Solr are affected by these bugs.

http://lucene.apache.org/#28+July+2011+-+WARNING%3A+Index+corruption+and+crashes+in+Apache+Lucene+Core+%2F+Apache+Solr+with+Java+7

The affected loop optimizations can be switched off by starting java with -XX:-UseLoopPredicate.

尘曦 2024-12-04 02:06:05

AFAIS 此处,Java 中没有弃用的 Java 6 功能7 所以是的,您的项目应该运行良好。

AFAIS here, there's no Java 6 features which get deprecated in Java 7 so yes, your project should run fine.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文