天天看点

Oracle JDK和OpenJDK之间的区别

本文翻译自:Differences between Oracle JDK and OpenJDK

NOTE: This question is from 2014. As of Java 11 OpenJDK and Oracle JDK are converging. 注意:此问题来自2014年。从Java 11开始,OpenJDK和Oracle JDK正在融合。

Are there any crucial differences between Oracle and OpenJDK?

Oracle和OpenJDK之间有什么重要区别吗?

For example, are the garbage collection and other JVM parameters the same?

例如,垃圾回收和其他JVM参数是否相同?

Does GC work differently between the two?

两者之间的GC工作方式是否有所不同?

#1楼

参考:https://stackoom.com/question/1VoM3/Oracle-JDK和OpenJDK之间的区别

#2楼

For Java 7 , nothing crucial.

对于Java 7 ,没有什么至关重要的。

The OpenJDK project is mostly based on HotSpot source code donated by Sun.

OpenJDK项目主要基于Sun捐赠的HotSpot源代码。

Moreover, OpenJDK was selected to be the reference implementation for Java 7 and is maintained by Oracle engineers.

此外,OpenJDK被选为Java 7的参考实现,并且由Oracle工程师维护。

There's a more detailed answer from 2012 on difference between JVM, JDK, JRE & OpenJDK , which links to an Oracle blog post :

2012年有一个关于JVM,JDK,JRE和OpenJDK之间差异的更详细的答案,该链接链接到Oracle博客文章 :
Q : What is the difference between the source code found in the OpenJDK repository, and the code you use to build the Oracle JDK? 问 :在OpenJDK存储库中找到的源代码与用于构建Oracle JDK的代码之间有什么区别? A : It is very close - our build process for Oracle JDK releases builds on OpenJDK 7 by adding just a couple of pieces, like the deployment code, which includes Oracle's implementation of the Java Plugin and Java WebStart, as well as some closed source third party components like a graphics rasterizer, some open source third party components, like Rhino, and a few bits and pieces here and there, like additional documentation or third party fonts. 答 :非常接近-我们针对Oracle JDK的构建过程是在OpenJDK 7上构建的,仅添加了几段代码,例如部署代码,其中包括Oracle对Java Plugin和Java WebStart的实现,以及一些封闭源代码。第三方组件,例如图形光栅化程序,一些开源第三方组件,例如Rhino,以及一些零散的地方,例如其他文档或第三方字体。 Moving forward, our intent is to open source all pieces of the Oracle JDK except those that we consider commercial features such as JRockit Mission Control (not yet available in Oracle JDK), and replace encumbered third party components with open source alternatives to achieve closer parity between the code bases. 展望未来,我们的意图是将Oracle JDK的所有部分开源,但那些我们认为具有商业功能的部分(如JRockit Mission Control(Oracle JDK中尚不可用)),并用开源替代品替代受累的第三方组件,以实现更紧密的比价在代码库之间。

#3楼

Both OpenJDK and Oracle JDK are created and maintained currently by Oracle only.

OpenJDK和Oracle JDK都仅由Oracle当前创建和维护。

OpenJDK and Oracle JDK are implementations of the same Java specification passed the TCK (Java Technology Certification Kit).

OpenJDK和Oracle JDK是通过TCK(Java技术认证套件)的同一Java规范的实现。

Most of the vendors of JDK are written on top of OpenJDK by doing a few tweaks to [mostly to replace licensed proprietary parts / replace with more high-performance items that only work on specific OS] components without breaking the TCK compatibility.

大多数JDK供应商都是在OpenJDK之上编写的,它们做了一些调整[主要是替换许可的专有部件/替换为仅在特定OS上可用的更多高性能项目]组件,而又没有破坏TCK兼容性。

Many vendors implemented the Java specification and got TCK passed.

许多供应商实施了Java规范并通过了TCK。

For example, IBM J9, Azul Zulu, Azul Zing, and Oracle JDK.

例如,IBM J9,Azul Zulu,Azul Zing和Oracle JDK。

Almost every existing JDK is derived from OpenJDK.

几乎每个现有的JDK都来自OpenJDK。

As suggested by many, licensing is a change between JDKs.

正如许多人所建议的那样,许可是JDK之间的一种变化。

Starting with JDK 11 accessing the long time support Oracle JDK/Java SE will now require a commercial license.

从JDK 11开始获得长期支持,Oracle JDK / Java SE现在将需要商业许可证。

You should now pay attention to which JDK you're installing as Oracle JDK without subscription could stop working.

现在,您应该注意要安装的JDK,因为没有订阅的Oracle JDK可能会停止工作。

source

资源

Ref: List of Java virtual machines

参考: Java虚拟机列表

#4楼

For Java 8 , Oracle JDK vs. OpenJDK my take of key differences:

对于Java 8 ,Oracle JDK与OpenJDK的主要区别在于:
  • OpenJDK is an open source implementation of the Java Standard Edition platform with contribution from Oracle and the open Java community. OpenJDK是Java Standard Edition平台的开源实现,由Oracle和开放Java社区贡献。
  • OpenJDK is released under license GPL v2 wherein Oracle JDK is licensed under Oracle Binary Code License Agreement. OpenJDK是根据GPL v2许可发行的,其中Oracle JDK是根据Oracle Binary Code许可协议获得许可的。
  • Actually, Oracle JDK's build process builds from OpenJDK source code. 实际上,Oracle JDK的构建过程是从OpenJDK源代码构建的。 So there is no major technical difference between Oracle JDK and OpenJDK. 因此,Oracle JDK和OpenJDK之间没有主要的技术差异。 Apart from the base code, Oracle JDK includes, Oracle's implementation of Java Plugin and Java WebStart. 除基本代码外,Oracle JDK还包括Oracle的Java Plugin和Java WebStart的实现。 It also includes third-party closed source and open source components like graphics rasterizer and Rhino respectively. 它还包括第三方封闭源和开放源组件,分别是图形光栅化器和Rhino 。 OpenJDK Font Renderer and Oracle JDK Flight Recorder are the noticeable major differences between Oracle JDK and OpenJDK. OpenJDK Font Renderer和Oracle JDK Flight Recorder是Oracle JDK和OpenJDK之间明显的主要区别。
  • Rockit was the Oracle's JVM and from Java SE 7, HotSpot and JRockit merged into a single JVM. Rockit是Oracle的JVM,并将Java SE 7,HotSpot和JRockit合并为一个JVM。 So now we have only the merged HotSpot JVM available. 因此,现在我们只有合并的HotSpot JVM可用。
  • There are instances where people claim that they had issues while running OpenJDK and that got solved when switched over to Oracle JDK. 在某些情况下,人们声称他们在运行OpenJDK时遇到问题,并且在切换到Oracle JDK时得到解决。
  • Twitter has its own JDK. Twitter有自己的JDK。
  • Software like Minecraft expects Oracle JDK to be used. 像Minecraft这样的软件希望使用Oracle JDK。 In fact, warns. 实际上,警告。

For a full list of differences please see the source article: Oracle JDK vs OpenJDK and Java JDK Development Process

有关差异的完整列表,请参见源文章: Oracle JDK与OpenJDK和Java JDK开发过程

#5楼

A key difference going forward is the release schedule and support policy.

未来的主要区别是发布时间表和支持策略。

OpenJDK OpenJDK的

OpenJDK will have a feature release every 6 months which is only supported until the next feature release.

OpenJDK将每6个月发布一次功能发布,仅在下一个功能发布之前受支持。

It's essentially a continuous stream of releases targeted to developers.

从本质上讲,这是针对开发人员的连续发行流。

Oracle JDK Oracle JDK

The Oracle JDK is targeted more towards an enterprise audience which values stability.

Oracle JDK更面向重视稳定性的企业用户。

It's based on one of the OpenJDK releases but is then given long term support (LTS).

它基于OpenJDK发行版之一,但随后获得了长期支持(LTS)。

The Oracle JDK has releases planned every 3 years.

Oracle JDK已计划每3年发布一次。
Oracle JDK和OpenJDK之间的区别

Source: https://www.oracle.com/java/java9-screencasts.html?bcid=5582439790001&playerType=single-social&size=events

来源: https : //www.oracle.com/java/java9-screencasts.html?bcid=5582439790001&playerType=single-social&size=events

#6楼

The Oracle and OpenJDK JVMs are the same and have the same GC features (as of the latest versions 10+).

Oracle和OpenJDK JVM是相同的,并且具有相同的GC功能(从最新版本10+开始)。

Prior to Oracle managing the OpenJDK JVM there were concrete differences that made that old Openjdk JVM almost unusable in many environments.

在Oracle管理OpenJDK JVM之前,存在具体的差异,这使得旧的Openjdk JVM在许多环境中几乎无法使用。

The JVMs are now the same.

JVM现在相同。

The JDKs which include the JVM as part of the Kit, differ by licensing, release and maintenance schedule, and the software libraries included in the JDK.

包含JVM作为工具包一部分的JDK,在许可,发行和维护时间表以及JDK中包含的软件库方面有所不同。

Crucial differences to me also mean things that would make code not run if not present.

对我来说,至关重要的差异还意味着如果不存在,那些会使代码无法运行的事情。

Not only licensing.

不仅是许可。
diff --brief -r openjdk oraclejdk
           

Crucially the following files are missing in addition to a bunch of others on the linux JDK (So if you 'claimed' that code didn't work on OpenJDK and did so on OracleJDK while you were using javafx then you were correct):

至关重要的是,除了Linux JDK上的其他文件之外,以下文件也丢失了(因此,如果您“声称”该代码在OpenJDK上不起作用,而在使用Javafx的OracleJDK上也是如此,那么您是正确的):
Only in jdk-10.0.1/bin: javapackager
Only in jdk-10.0.1/bin: javaws
Only in jdk-10.0.1/bin: jcontrol
Only in jdk-10.0.1/bin: jmc
Only in jdk-10.0.1/bin: jweblauncher
Only in jdk-10.0.1/lib: ant-javafx.jar
Only in jdk-10.0.1/lib: deploy
Only in jdk-10.0.1/lib: deploy.jar
Only in jdk-10.0.1/lib: desktop
Only in jdk-10.0.1/lib: fontconfig.bfc
Only in jdk-10.0.1/lib: fontconfig.properties.src
Only in jdk-10.0.1/lib: fontconfig.RedHat.6.bfc
Only in jdk-10.0.1/lib: fontconfig.RedHat.6.properties.src
Only in jdk-10.0.1/lib: fontconfig.SuSE.11.bfc
Only in jdk-10.0.1/lib: fontconfig.SuSE.11.properties.src
Only in jdk-10.0.1/lib: fonts
Only in jdk-10.0.1/lib: javafx.properties
Only in jdk-10.0.1/lib: javafx-swt.jar
Only in jdk-10.0.1/lib: java.jnlp.jar
Only in jdk-10.0.1/lib: javaws.jar
Only in jdk-10.0.1/lib: jdk.deploy.jar
Only in jdk-10.0.1/lib: jdk.javaws.jar
Only in jdk-10.0.1/lib: jdk.plugin.jar
Only in jdk-10.0.1/lib: jfr
Only in jdk-10.0.1/lib: libavplugin-53.so
Only in jdk-10.0.1/lib: libavplugin-54.so
Only in jdk-10.0.1/lib: libavplugin-55.so
Only in jdk-10.0.1/lib: libavplugin-56.so
Only in jdk-10.0.1/lib: libavplugin-57.so
Only in jdk-10.0.1/lib: libavplugin-ffmpeg-56.so
Only in jdk-10.0.1/lib: libavplugin-ffmpeg-57.so
Only in jdk-10.0.1/lib: libbci.so
Only in jdk-10.0.1/lib: libcmm.so
Only in jdk-10.0.1/lib: libdecora_sse.so
Only in jdk-10.0.1/lib: libdeploy.so
Only in jdk-10.0.1/lib: libfxplugins.so
Only in jdk-10.0.1/lib: libglassgtk2.so
Only in jdk-10.0.1/lib: libglassgtk3.so
Only in jdk-10.0.1/lib: libglass.so
Only in jdk-10.0.1/lib: libgstreamer-lite.so
Only in jdk-10.0.1/lib: libjavafx_font_freetype.so
Only in jdk-10.0.1/lib: libjavafx_font_pango.so
Only in jdk-10.0.1/lib: libjavafx_font.so
Only in jdk-10.0.1/lib: libjavafx_iio.so
Only in jdk-10.0.1/lib: libjfxmedia.so
Only in jdk-10.0.1/lib: libjfxwebkit.so
Only in jdk-10.0.1/lib: libnpjp2.so
Only in jdk-10.0.1/lib: libprism_common.so
Only in jdk-10.0.1/lib: libprism_es2.so
Only in jdk-10.0.1/lib: libprism_sw.so
Only in jdk-10.0.1/lib: librm.so
Only in jdk-10.0.1/lib: libt2k.so
Only in jdk-10.0.1/lib: locale
Only in jdk-10.0.1/lib: missioncontrol
Only in jdk-10.0.1/lib: oblique-fonts
Only in jdk-10.0.1/lib: plugin.jar
Only in jdk-10.0.1/lib: plugin-legacy.jar
Only in jdk-10.0.1/lib/security: blacklist
Only in jdk-10.0.1/lib/security: public_suffix_list.dat
Only in jdk-10.0.1/lib/security: trusted.libraries
Only in openjdk-10.0.1: man`