Java SE 8:Java 7编译的JAR是否与Java 8完全兼容? [英] Java SE 8: Would a Java 7 compiled JAR be compatible completely with Java 8?

查看:260
本文介绍了Java SE 8:Java 7编译的JAR是否与Java 8完全兼容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Java 7中编译了旧的JAR文件,我的生产环境中有Java 8.在将JAR文件直接部署到Java 8环境中需要注意什么?我测试在Java 8上运行它们并且它工作正常。我可以遇到任何问题或者我应该没事吗?我想知道这一点,因为我正在讨论删除Java 8并安装Java 7.

I compiled my old JAR files in Java 7 and my production environment has Java 8. Is there anything I need to be careful about directly deploying the JAR files onto Java 8 Environment? I test ran them on Java 8 and it worked fine. Could I encounter any problems or should I be fine? I was wondering this because I was debating removing Java 8 and installing Java 7.

编辑:一个侧面问题:公司在更新Java版本时是否更新了代码?我无法想象这必须是多么痛苦,所以你的应用程序在以前的版本上运行然后在新版本上完全失败。

A side question: Do companies update their code when they update their Java version? I can't imagine how painful this must be so have your app working on a previous version and then completely fail on the new version.

推荐答案


我想知道这是因为我在讨论删除Java 8并安装Java 7。

I was wondering this because I was debating removing Java 8 and installing Java 7.

I假设你是指另一种方式?

I assume you mean the other way around?

Java试图尽可能保持向后兼容性,所以理论上至少你应该没问题。

Java attempts to maintain backwards compatibility as far as it can, so theoretically at least you should be ok.

然而,在实践中,问题确实会出现,所以我主张彻底测试。这些可能是由于回归错误,或者(根据我的经验)可能在Java 7下运行良好的错误代码,但不在8以下。(FWIW,我有几个FX应用程序混合在8以下但运行良好7,事实证明两者都是由于我的代码中的错误,在运行7时巧合没有异常的副作用。)

In practice however, issues do sometimes come up, so I'd advocate testing thoroughly. These may be due to regression bugs, or (more likely in my experience) buggy code that might have run fine under Java 7, but not under 8. (FWIW, I had a couple of FX apps that mixbehaved under 8 but ran fine under 7, it turned out both were due to bugs in my code that coincidentally had no unusual side effects when running with 7.)

这篇关于Java SE 8:Java 7编译的JAR是否与Java 8完全兼容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆