VB.net 2010 视频教程 VB.net 2010 视频教程 python基础视频教程
SQL Server 2008 视频教程 c#入门经典教程 Visual Basic从门到精通视频教程
当前位置:
首页 > 编程开发 > Java教程 >
  • 码农飞升记-02-OracleJDK是什么?OracleJDK的版本怎么选择?

1.Oracle JDK 是什么?

我们知道,JDK 是 Java Development Kit 的缩写,翻译过来就是 Java 开发工具包。

Oracle JDK 源自 Sun JDK(2009年 Oracle 收购 Sun),Oracle JDK 自然就是 Oracle 公司出品的 JDK。所以 Oracle JDK 就是 Oracle 公司开发维护的 Java 开发工具包。
但是只是这样理解未免太片面了一点。

根据 Java Platform Group 产品管理高级总监 Donald Smith 在" Oracle JDK Releases for Java 11 and Later "中的描述:

What should we call them?

Ideally, we would simply refer to all Oracle JDK builds as the “Oracle JDK,” either under the GPL or the commercial license depending on your situation. However, for historical reasons while the small remaining differences exist, we will refer to them separately as Oracle’s OpenJDK builds, and the Oracle JDK.

因为本人英语烂到了令人发指的地步,为了避免浪费时间和不必要的翻译错误,这里就简单引用谷歌翻译的结果方便粗略理解:

理想情况下,我们会根据您的情况将所有 Oracle JDK builds 简单地称为 GPL 或商业许可下的 "Oracle JDK",但是,由于历史原因,尽管存在很小的差异,但我们将在 Oracle's OpenJDK builds 和 Oracle JDK 中分别引用它们。

根据以上内容,我们可以知道 Oracle JDK builds 实际上包括了一个开源版本的 Oracle's OpenJDK builds(基于 GPL 开源)和商业版本的 Oracle JDK builds,但是因为其本身写法繁琐和对开发没有多大作用,外界一般把他们粗略称为 Open JDK 和 Oracle JDK。(胡乱简写害死人系列,这是下一章的一个坑)

所以由此可知,Oracle JDK 实际上有几种含义:

  1. 由 Oracle 公司推出的商业 JDK (最常用)
  2. 由 Oracle 公司推出的 JDK (Oracle JDK builds下所有的 JDK)
  3. Oracle JDK builds

在大部分情况下的 Oracle JDK 指的是 Oracle 公司推出的商业版 JDK。

2.Oracle JDK 版本如何选择?

说到 Oracle JDK 该怎么选择 ,这就不得不提到 Oracle JDK 发布的众多版本了。

要是有兴趣可以去 Java发展历程 看看 Oracle JDK 到底有哪些版本。

截止目前:2021年5月4日,Oracle JDK一共有17个大版本。在众多版本中如何选择适合的版本进行使用,就成了一个比较头痛的问题。要想知道究竟哪个版本适合自己,就必须得先了解一下 Java SE 的发布节奏以及每个版本间的差距。

1.Java SE 发布节奏以及不同版本的差距

1.Java SE 8 以及之前版本的发布节奏和不同版本的差距

根据 Java CPU and PSU Releases Explained里面的描述:

Which Java version should I choose: the CPU or the PSU?

Oracle strongly recommends that all Java SE users upgrade to the latest CPU release available for a release family. Most users should choose the CPU release.

Users should only use the corresponding PSU release if they are being impacted by one of the additional bugs fixed in that version as noted in the release notes.

The subsequent CPU release will contain all of the fixes from the current PSU. For this reason, organizations should test the current PSU in their environment in anticipation of these fixes being included in the next CPU.

What is the difference between a Java CPU and PSU release?

Java SE Critical Patch Updates (CPU) contain fixes to security vulnerabilities and critical bug fixes. Oracle strongly recommends that all Java SE users upgrade to the latest CPU releases as they are made available. Java SE CPU releases are odd numbered versions (i.e. 7u71, 7u65 – see more on Java SE version numbering schemes here).

Java SE Patch Set Updates (PSU) contain all of fixes in the corresponding CPU, as well as additional non-critical fixes. Java PSU releases should only be used if you are being impacted by one of the additional bugs fixed in that version. The release notes call out the additional fixes available in Java SE PSU releases.

Is the cadence of CPU releases changing?

As before, Java SE CPU releases are scheduled for release on the Tuesday closest to the 17th day of January, April, July and October under the normal Oracle Critical Patch Update schedule.

Starting in October 2014 with the release of Java SE 7u71 (CPU) and Java SE 7u72 (PSU), Oracle plans to additionally release a corresponding PSU release along with each CPU release for Java SE 7. PSU releases provide organizations and developers with access to non-critical fixes in addition to the critical fixes contained in the corresponding CPU.

1.发布的版本区别

CPU (Critical Patch Updates):关键补丁更新(CPU)包含对安全漏洞和关键错误的修复。Oracle 强烈建议所有 Java SE 用户升级到最新的 CPU 版本。Java SE CPU 版本是奇数版本(即7u71、7u65–请参阅此处有关Java SE版本编号方案的更多信息)。

PSU (Patch Set Updates):补丁集更新(PSU)包含相应 CPU 中的所有修复,以及其他非关键修复。只有当您受到该版本中修复的其他错误之一的影响时,才应使用Java PSU版本。Java SE PSU 版本是偶数版本,版本说明中列出了Java SE PSU 发行版中提供的其他修复程序。

PS:

  • Oracle 强烈建议所有 Java SE 用户升级到一个版本系列的最新 CPU 版本。大多数用户应该选择 CPU 版本。
  • 如果用户受到版本说明中所述的该版本中修复的其他错误之一的影响,则只能使用相应的PSU 版本。
  • 随后的 CPU 版本将包含当前 PSU 的所有修复程序。因此,组织应在其环境中测试当前 PSU ,以预期这些修复将包含在下一个 CPU中。
  • 从2014年10月开始,随着 Java SE 7u71(CPU)和 Java SE 7u72(PSU)的发布,Oracle 计划在 Java SE 7的每个 CPU 发布版本的同时,额外发布一个相应的 PSU 版本

2.发布周期

Java 每两年发布一次,直到 Java 6于2006年12月23日在 Sun 下发布为止。由于政治上的僵局,下一个版本是2011年7月28日发布的 Java 7。

在2012年3月7日于伦敦举行的 QCon 2012 大会上,前 Sun Microsystems 负责人、现任 Oracle Java 产品经理 Simon Ritter 承诺 Java 将回到两年的发布周期。

但在2013年4月18日时,Oracle 公司 Java Platform Group 首席架构师 Mark Reinhold 在博客中表示:Oracle 计划将 Java 8 的计划发布推迟到明年,理由是为了修复 Java 的安全漏洞。

3.版本的关系

版本内的更新:例如:Java 8 > Java 8u20 > Java 8u40,大多是对一些安全漏洞的修复和小型功能更新,版本间差距较小(除安全漏洞外)。

版本间的更新:例如:Java 6 > Java 7> Java 8,有较大修改、更新和安全漏洞修复,和传统版本一样,每一个数字的变动都是一次巨大的改革,版本间差距巨大。

2.Java SE 9 以及之后版本的发布节奏和不同版本的差距

根据 Java Platform Group 产品管理高级总监 Donald Smith 在" Update and FAQ on the Java SE Release Cadence "中的描述以及 Oracle Java SE Support Roadmap 的描述,提炼出我们需要的部分:从 Java SE 9 开始 Java 开启了一个新的版本控制和发布节奏模型。

Q1: Surely you can’t expect everyone to adopt major releases every six months?!

There are no “major releases” per se any more; that is now a legacy term. Instead there is a steady stream of “feature releases.” This is consistent with how many releases have been done in the past, except with a new take on versioning. For example, Java 8 launched in March 2014. 8u20, a feature release, was released almost six months later in August. 8u40, the next feature release, was released almost six months after that.

So yes, we expect an uptake of “feature releases” every six months, just as before.

Going from Java 9->10->11 is closer to going from 8->8u20->8u40 than from 7->8->9. It’s scary to see at first when you’re used to major releases about every three years and have a mental model of the huge impact of those major changes. The six-month cadence is not that. Later in the FAQ we’ll provide more specific proof of this.

Q2: If the new releases are basically the long standing six-month cadence, why rev the major release number each time? Why not just call it 9u20, 9u40, etc.?

By having streamlined some JCP processes, it’s now possible to introduce new class library, JVM and language features such as Local-Variable Type Inference in just six months, instead of having to wait years for a “major release.” Rather than releasing dozens of large changes to the specifications every couple of years, they can be more pragmatically introduced in a steady stream as soon as they are ready for adoption.

Q5: I’m still not convinced. Java 9 was a challenge to adopt, so that means 10 and 11 will be, too.

Many Java SE developers and user have historically waited for a couple of updates before adopting a new “major version.” This could be expected when there were dozens of major new spec-changing features in a “major” release, but won’t be the case going forward with six-month releases. This has not been the case since Java SE 9.

For example, the Java SE 9 release incorporated approximately 19,000 source code changes on top of Java SE 8. There were only 2,700 such changes between Java 9 and Java 10 – approximately the same as between Java 8 and Java 8u40. So while Java SE 9 was a “major” upgrade compared to Java SE 8, we have already seen that Java SE 10 is a simple feature update to Java SE 9.

Q7: Ok, but I don’t want new features. I have a system in production and just want stability, performance and security updates only. What do I do?

At Oracle, our intent is to designate releases every three years as “Long Term Support” (LTS) releases starting with Java SE 11 in September 2018. So while Java SE 9 has reached its End of Life with the release of Java 10, and Java 10 will do the same with the release of Java 11, Java 11 will have commercial support from Oracle available for at least eight additional years.

As has happened for almost a decade with Java 6 and Java 7 (and likely Java 8 in 2019), once Oracle stops contributing our source code changes to a particular release series in OpenJDK, so that we can focus on the needs of our customers, other qualified contributors in the OpenJDK Community may step in to continue to maintain the release series. They do so in accordance with OpenJDK Community standards for as long as they choose, backporting the relevant changes from later releases still maintained by Oracle and others. For example, for JDK 6, Sun established the project in 2008, and Oracle continued to maintain it until 2013. Other maintainers then continued working on the project by backporting updates from later releases.

Oracle supports such transitions in the OpenJDK Community by providing an established process for them to take place within the JDK Updates Project, as well as assistance to new maintainers to settle in their new roles, and last but not least, the Vulnerability Group.

Oracle Java SE Product Releases

Oracle provides Customers with Oracle Premier Support on Oracle Java SE products as described in the Oracle Lifetime Support Policy. For product releases after Java SE 8, Oracle will designate a release, every three years, as a Long-Term-Support (LTS) release. Java SE 11 is an LTS release. For the purposes of Oracle Premier Support, non‑LTS releases are considered a cumulative set of implementation enhancements of the most recent LTS release. Once a new feature release is made available, any previous non‑LTS release will be considered superseded. For example, Java SE 9 was a non‑LTS release and immediately superseded by Java SE 10 (also non‑LTS), Java SE 10 in turn is immediately superseded by Java SE 11. Java SE 11 however is an LTS release, and therefore Oracle Customers will receive Oracle Premier Support and periodic update releases, even though Java SE 12 was released.

1.发布的版本区别

LTS版本(Long Term Support,长期支持版本),提供至少八年的商业支持(根据市场需要有可能会延长),到期后会被新的 LTS 版本取代。

non-LTS版本(non Long Term Support,非长期支持版本),提供六个月的商业支持,到期后会被新发布的版本取代。

2.发布周期

整体发布周期为每六个月发布一版,其中:

LTS版本:每三年发布一版

non-LTS版本:每六个月发布一版

PS:

  • 当二者发布时间冲突时,优先发布LTS版本,non-LTS版本向后推迟一个周期。

3.版本的关系

版本内的更新:例如:Java 11 > Java 11.0.1 > Java 11.0.2,大多是对一些安全漏洞的修复,版本间差距几乎没有(除安全漏洞外)。

版本间的更新:例如:Java 9 > Java 10 >Java 11更接近于从 Java 8 > 8u20 > 8u40,每六个月发布一次的 non-LTS 版本更像"主要版本"的"功能发布",LTS版本更像是主要版本,而non-LTS版本更像是包含上一个LTS版本的测试版本,版本间差距较大。

2.Oracle JDK收费吗?

知道了 Java SE 发布节奏以及不同版本的差距之后,最能影响人们做出选择的应该就是价格问题了。
没错了,Oracle JDK 也是要收费的,不过并不是所有版本都收费,也不是所有用途都收费。

05-Oracle Java Archive.png (1403×733) (gitee.com)

从 Java 的历史版本中我们可以看到一个有趣的现象,Java SE 8 这个标题出现了两次,分别是Java SE 8u202和之前版本和Java SE 8u211和之后的版本。

为什么会出现这个现象呢?

2019年4月16日以及之前发布的 OracleJDK 版本使用的是 Binary Code License

2019年4月16日以及之后发布的 OracleJDK 版本使用的是 Java SE OTN License

因为这两个许可证有着巨大的区别,根据这两个许可证长篇累牍的描述结合 RednaxelaFX 在 Oracle 终于要向 Java 的非付费用户开枪了-怎么看?和采用java开发商业软件需要给Oracle付钱吗?两个问题的回答提炼出了几个要点。

许可证 免费学习 免费个人使用 免费开发 免费测试 免费商业功能 免费商业使用 免费在台式机/笔记本上使用 免费在服务器上使用 免费嵌入式设备和其他计算环境上使用
Binary Code License
Java SE OTN License -

PS:

  • 商业功能指的是 Oracle JDK 自带的 HotSpot VM 的启动参数中是否有 -XX:+UnlockCommercialFeatures,如果有 -XX:+UnlockCommercialFeatures 就代表启动了商业功能,这个功能默认是关闭状态,需要手动开启(在 Java 11 中被废除)。
  • Java Flight Recorder(JFR) 已经加入 Open JDK 11,在 Open JDK 11/bin 下可以直接启动,或者在 HotSpot VM 的启动参数中加上 -XX:StartFlightRecording。

采用 Binary Code License 的 OracleJDK 10 及其之前的版本(包含OracleJDK 8u201/8u202及其以前版本,不包含 OracleJDK 8u211/8u212及其以后版本),个人使用和商用几乎是免费的(不使用商业功能和嵌入式设备的情况下)。

采用 Java SE OTN License 的 OracleJDK 11 及其之后的版本(包含 OracleJDK 8u211/8u212及其以后版本,不包含 OracleJDK 8u201/8u202及其以前版本),个人使用免费,商用就要购买许可证才可以(虽然可以偷偷商用,不过那种操作就跟裸奔过雷区一样,你也不知道啥时候会灰飞烟灭,也不知道 Oracle 会不会等养肥了再宰。若想使用免费商用的 Java 11及其之后版本,可以使用其他厂商提供的 OpenJDK builds,参考---OpenJDK是什么?)。

3.总结

洋洋洒洒地写了那么多,写的我都快从 Java 入门到提桶跑路了(其实是知识储备不够,一边写一边查),颇有一种重学Java的感觉。就不多说了,开始总结:

在 JDK 的选择上其实还有一个大类,那就是 Open JDK builds,不过那是下下一章讨论的事情了。

在只考虑使用 Oracle JDK 的情况下,需要考虑的就只有三个因素:商用稳定性新技术

如果需要商用又不想给钱,那么就只能选择使用 Binary Code License 的版本,也就是8u201(CPU)/8u202(PSU)以及之前的版本,最后一版免费商用的 Oracle JDK 就是 Java 8u201/8u202。

如果需要稳定性就选择最新的LTS版本。

如果需要使用最新技术且对稳定性没有要求,那就谁新选谁。
如果需要使用最新技术且对稳定性有要求,那就选最新的LTS版本。

如果需要使用最新技术且对稳定性有要求,还要商用不给钱,那就只有 Open JDK builds 能救你了,这就是下下一章介绍的内容了,疯狂赶稿中……


原文:https://www.cnblogs.com/HeavenZhi/p/14729342.html


相关教程