天天看點

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`