Java JDK 11打破旧的罐子/程序 [英] Java JDK 11 Breaking Old Jars/Programs

查看:91
本文介绍了Java JDK 11打破旧的罐子/程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我了解,Java JRE是向后兼容的,如果您用Java(JDK)7编写程序,它将与Java(JRE)8一起运行.

It is to my understanding that Java JREs are backwards compatible, if you write a program in Java (JDK) 7, it will run with Java (JRE) 8.

我有一些用Java 8开发的程序,并且有.jar和EXE文件,这些文件是我完成后生成的,它们始终可以正常运行.但是,在安装Java JDK 11(11.0.2)之后,这些旧的.jar文件会损坏...

I have a couple of programs I developed in Java 8, and have .jar and EXE files that I built when I finished them, and they always ran fine. However, after installing Java JDK 11 (11.0.2), these old .jar files break...

  • 其中一些仍然可以运行,但是它们的GUI扩展了,按钮和图像比以前更大了,在某些情况下还模糊了
  • 一个程序根本无法运行,尝试在控制台中运行会产生异常:"线程" AWT-EventQueue-0中的异常java.lang.NoClassDefFoundError:javax/activation/ActivationDataFlavor "

我知道该类和其他一些Javax类已从JDK 11中删除,因此从开发的角度来看,如果没有Maven之类的工具,您将无法再使用它们.但是我不明白为什么安装JDK 11会对我的旧jar产生任何影响,因为我没有安装新的JRE,即使附带了新的JRE,它也应该向后兼容吗?

I understand that this class and some other javax classes have been removed from JDK 11, so from a development standpoint you couldn't use them anymore without a tool such as Maven. But I do not understand why installing JDK 11 has any effect on my old jars, as I didn't install a new JRE, and even if one came with it, it should be backwards compatible?

此外,我使用的是Apache NetBeans 10,它在Java 8上运行良好,但是在安装JDK 11之后,NetBeans 10仍然可以运行,但是其加载窗口很大且模糊,IDE的图像也很模糊,所有文本更大.

Too add to this, I use Apache NetBeans 10, it worked fine with Java 8, but after I installed JDK 11, NetBeans 10 still ran but its loading window was big and blurry, and the IDE's images are blurry, and all the text is bigger.

那么,为什么安装JDK 11对较旧的程序有这些负面影响?

注意-我曾尝试将jars/EXE与JRE版本8(201)中的javaw.exe关联,但是它们仍然存在相同的问题.

推荐答案

Java试图向后兼容,但有时必须进行重大更改以发展生态系统.到目前为止,重大更改已随主要版本一起发布,例如Java 9、10、11.在您的情况下,您很可能会受到Java 11的 JEP 320的影响:删除Java EE和CORBA模块.

Java tries to be backward compatible but sometimes breaking changes are necessary to evolve the ecosystem. Until now breaking changes were shipped with major release e.g. Java 9, 10, 11. In your case you are most likely affected by Java 11's JEP 320: Remove the Java EE and CORBA Modules.

请记住,Java 8是在2014年 发布的.五年来,Oracle和Java社区为Java 8提供了补丁程序和安全修复程序,但要永远做到这一点是不可能的.

Remember that Java 8 was released in 2014. For 5 years Oracle and the Java community provided patches and security fixes for Java 8 but doing this forever is impossible.

这篇关于Java JDK 11打破旧的罐子/程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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