825

NOTE: This question is from 2014. As of Java 11 OpenJDK and Oracle JDK are converging.

Are there any crucial differences between Oracle and OpenJDK?

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

Does GC work differently between the two?

2

13 Answers 13

429

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

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

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.

Many vendors implemented the Java specification and got TCK passed. For example, IBM J9, Azul Zulu, Azul Zing, and Oracle JDK.

Almost every existing JDK is derived from OpenJDK.

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

Starting with JDK 11 accessing the long time support Oracle JDK/Java SE will now require a commercial license. You should now pay attention to which JDK you're installing as Oracle JDK without subscription could stop working. source

Ref: List of Java virtual machines

12
  • 21
    So your saying that openjdk is the baseline for all the other jdks just that they copy it and then tweak it after it's own specifications?
    – basickarl
    Aug 20, 2016 at 12:37
  • 39
    I'm late to the party, but I'll ask anyway. What does jdk bring to the table that openjdk doesn't? All these answers make openjdk sound like it's equal to or superior in every way, but if that's the case why does Oracle even bother maintaining jdk?
    – Kefka
    Jan 27, 2018 at 2:07
  • @ Karl Morrison As far I know,.. everyone implementing JVM spec doing that way only.. but there is no explicit rule that one has to follow that way... Feb 6, 2018 at 6:02
  • 17
    @ Mella OpenJDK <= OracleJDK For example, Oracle JDK has Few trusted keys set up, which were not in OpenJDK(Now a days people are just importing them to fill this gap) Oracle JDK has some SWING libraries which are proprietory for speeding up rendering..(Who ever doing server apps, might be irrelevant for them) Oracle JDK has Applet plugin (Same reason above works) Oracle JDK bugfix/hotfix would be distributed and handle properly by Oracle where As OpenJDK it is little technical to ensure all the patches are applied and what conflict they would have Feb 6, 2018 at 6:02
  • Note with the new release model for java, Oracle plans to reduce the gap as much as possible between both jdk's. Are there other open source contributors to open jdk other than oracle developers? This is to understand if there would be enough support to backport a fix from the latest version to the previous version. Any thoughts? May 10, 2018 at 5:34
347

For Java 7, nothing crucial. The OpenJDK project is mostly based on HotSpot source code donated by Sun.

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

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

Q: What is the difference between the source code found in the OpenJDK repository, and the code you use to build the 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. 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.

11
  • 52
    Also there are licensing differences.
    – mcoolive
    Mar 18, 2015 at 11:03
  • 10
    thanks i found a better answer. stackoverflow.com/questions/17360011/…
    – astroanu
    Mar 30, 2015 at 5:12
  • 9
    On ARM at least those two seem to be significantly different in performance. I would have to do some profiling on why it is happening, but the subjective difference is "Oracle JDK is ok" and "OpenJDK is completely unusable".
    – dualed
    Sep 10, 2015 at 12:02
  • 1
    @dualed nevertheless android is moving to openjdk starting from android 7. Looks like they are prepairing significant improvements. venturebeat.com/2015/12/29/…
    – Johnny Doe
    Jan 5, 2016 at 20:45
  • 1
    @JohnnyDoe Lets hope that if google is moving to OpenJDK, they will provide upstream with performance patches so that it runs well on ARM outside of Android as well!
    – dualed
    Jan 8, 2016 at 14:10
113

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

OpenJDK

OpenJDK will have a feature release every 6 months which is only supported until the next feature release. It's essentially a continuous stream of releases targeted to developers.

Oracle JDK

The Oracle JDK is targeted more towards an enterprise audience which values stability. It's based on one of the OpenJDK releases but is then given long term support (LTS). The Oracle JDK has releases planned every 3 years.

enter image description here

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

3
  • 3
    Long term releases require you to buy commercial support to get updates after 6 months of the java release. What is the significance of long term releases when compared with short term releases? Do short term releases like JDK 9/10 do not have commercial support from Oracle? May 10, 2018 at 5:35
  • @AndyDufresne why do you think you will have to pay for support after only 6 months? My understanding is that the timeline is TBD. 6 month seems awfully short though... I doubt we can expect public updates for 5 years, like Java 8 is getting, but I wouldn't be surprised if there were public updates for 2 or 3 years. Reference - This is per: oracle.com/technetwork/java/eol-135779.html. May 10, 2018 at 16:47
  • 1
    The oracle link mentions "For e.g, the LTS release for Oracle JDK 11 (18.9 LTS) will be supported for at least 5 years as described in the Oracle Lifetime Support Policy". The policy has 3 levels of support none of them look to be free. Also I mention this after looking at azul CTO's comment here - blog.takipi.com/java-11-will-include-more-than-just-features/…. The main goal of this new release strategy is to not spend time in maintaining old releases. If the support were free the model would be the same as it has been till now. May 11, 2018 at 7:20
48

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

  • OpenJDK is an open source implementation of the Java Standard Edition platform with contribution from Oracle and the open Java community.

  • OpenJDK is released under license GPL v2 wherein Oracle JDK is licensed under Oracle Binary Code License Agreement.

  • Actually, Oracle JDK’s build process builds from OpenJDK source code. So there is no major technical difference between Oracle JDK and OpenJDK. Apart from the base code, Oracle JDK includes, Oracle’s implementation of Java Plugin and Java WebStart. It also includes third-party closed source and open source components like graphics rasterizer and Rhino respectively. OpenJDK Font Renderer and Oracle JDK Flight Recorder are the noticeable major differences between Oracle JDK and OpenJDK.

  • Rockit was the Oracle’s JVM and from Java SE 7, HotSpot and JRockit merged into a single JVM. So now we have only the merged HotSpot JVM available.
  • There are instances where people claim that they had issues while running OpenJDK and that got solved when switched over to Oracle JDK.
  • Twitter has its own JDK.
  • Software like Minecraft expects Oracle JDK to be used. In fact, warns.

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

2
  • 5
    For Android Studio, this is no longer true: A copy of the latest OpenJDK comes bundled with Android Studio 2.2 and higher, and this is the JDK version we recommend you use for your Android projects. Source: developer.android.com/studio/intro/studio-config#jdk
    – MKesper
    Oct 25, 2018 at 11:59
  • 1
    “Software like Minecraft expects Oracle JDK to be used. In fact, warns.” Actually, in Ubuntu, Mojang’s official .deb installer pulls in OpenJDK when installing the launcher. Mar 18, 2020 at 3:50
37

The Oracle and OpenJDK JVMs are the same and have the same GC features (as of the latest versions 10+). Prior to Oracle managing the OpenJDK JVM there were concrete differences that made that old Openjdk JVM almost unusable in many environments. The JVMs are now the same.

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. 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):

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`
1
  • 8
    Thank you for pointing at the real differences: code not running is a real-life matter. From where did you base your diff on?
    – Matthieu
    Oct 9, 2018 at 10:34
26

According to the oracle blog, Oracle JDK Releases for Java 11 and Later

Starting with Java 11, Oracle will provide JDK releases under the open source GNU General Public License v2, with the Classpath Exception (GPLv2+CPE), and under a commercial license for those using the Oracle JDK as part of an Oracle product or service, or who do not wish to use open source software. This combination of using an open source license and a commercial license replaces the historical “BCL” license, which had a combination of free and paid commercial terms.

Different builds will be provided for each license, but these builds are functionally identical aside from some cosmetic and packaging differences, described in detail below.

From the BCL to the GPL

The Binary Code License for Oracle Java SE technologies (“BCL”) has been the primary license for Oracle Java SE technologies for well over a decade. The BCL permits use without license fees under certain conditions. To simplify things going forward, Oracle started providing open source licensed OpenJDK builds as of Java 9, using the same license model as the Linux platform. If you are used to getting Oracle Java SE binaries for free, you can simply continue doing so with Oracle’s OpenJDK builds available at jdk.java.net. If you are used to getting Oracle Java SE binaries as part of a commercial product or service from Oracle, then you can continue to get Oracle JDK releases through My Oracle Support (MOS), and other locations.

Functionally identical and interchangeable...

Oracle’s BCL-licensed JDK historically contained “commercial features” that were not available in OpenJDK builds. As promised, however, over the past year Oracle has contributed these features to the OpenJDK Community, including:

From Java 11 forward, therefore, Oracle JDK builds and OpenJDK builds will be essentially identical.

...yet with some cosmetic and packaging differences

There do remain a small number of differences, some intentional and cosmetic, and some simply because more time to discuss with OpenJDK contributors is warranted.

  • Oracle JDK 11 emits a warning when using the -XX:+UnlockCommercialFeatures option, whereas in OpenJDK builds this option results in an error. This option was never part of OpenJDK and it would not make sense to add it now, since there are no commercial features in OpenJDK. This difference remains in order to make it easier for users of Oracle JDK 10 and earlier releases to migrate to Oracle JDK 11 and later.
  • Oracle JDK 11 can be configured to provide usage log data to the “Advanced Management Console” tool, which is a separate commercial Oracle product. We will work with other OpenJDK contributors to discuss how such usage data may be useful in OpenJDK in future releases, if at all. This difference remains primarily to provide a consistent experience to Oracle customers until such decisions are made.
  • The javac --release command behaves differently for the Java 9 and Java 10 targets, since in those releases the Oracle JDK contained some additional modules that were not part of corresponding OpenJDK releases:
    • javafx.base
    • javafx.controls
    • javafx.fxml
    • javafx.graphics
    • javafx.media
    • javafx.web
    • java.jnlp
    • jdk.jfr
    • jdk.management.cmm
    • jdk.management.jfr
    • jdk.management.resource
    • jdk.packager.services
    • jdk.snmp

This difference remains in order to provide a consistent experience for specific kinds of legacy use. These modules are either now available separately as part of OpenJFX, are now in both OpenJDK and the Oracle JDK because they were commercial features which Oracle contributed to OpenJDK (e.g., Flight Recorder), or were removed from Oracle JDK 11 (e.g., JNLP).

  • The output of the java --version and java -fullversion commands will distinguish Oracle JDK builds from OpenJDK builds, so that support teams can diagnose any issues that may exist. Specifically, running java --version with an Oracle JDK 11 build results in:

java 11 2018-09-25

Java(TM) SE Runtime Environment 18.9 (build 11+28)

Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11+28, mixed mode)

And for an OpenJDK 11 build:

openjdk version "11" 2018-09-25

OpenJDK Runtime Environment 18.9 (build 11+28)

OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode)

  • The Oracle JDK has always required third party cryptographic providers to be signed by a known certificate. The cryptography framework in OpenJDK has an open cryptographic interface, meaning it does not restrict which providers can be used. Oracle JDK 11 will continue to require a valid signature, and Oracle OpenJDK builds will continue to allow the use of either a valid signature or unsigned third party crypto provider.
  • Oracle JDK 11 will continue to include installers, branding and JRE packaging for an experience consistent with legacy desktop uses. Oracle OpenJDK builds are currently available as zip and tar.gz files, while alternative distribution formats are being considered.
17
  1. Oracle will deliver releases every three years, while OpenJDK will be released every six months.
  2. Oracle provides long term support for its releases. On the other hand, OpenJDK supports the changes to a release only until the next version is released.
  3. Oracle JDK was licensed under Oracle Binary Code License Agreement, whereas OpenJDK has the GNU General Public License (GNU GPL) version 2 with a linking exception.
  4. Oracle product has Flight Recorder, Java Mission Control, and Application Class-Data Sharing features, while OpenJDK has the Font Renderer feature.Also, Oracle has more Garbage Collection options and better renderers,
  5. Oracle JDK is fully developed by Oracle Corporation whereas the OpenJDK is developed by Oracle, OpenJDK, and the Java Community. However, the top-notch companies like Red Hat, Azul Systems, IBM, Apple Inc., SAP AG also take an active part in its development.

From Java 11 turn to a big change

Oracle will change its historical “BCL” license with a combination of an open source and commercial license

  • Oracle’s kit for Java 11 emits a warning when using the -XX:+UnlockCommercialFeatures option, whereas in OpenJDK builds, this option results in an error
  • Oracle JDK offers a configuration to provide usage log data to the “Advanced Management Console” tool
  • Oracle has always required third party cryptographic providers to be signed by a known certificate, while cryptography framework in OpenJDK has an open cryptographic interface, which means there is no restriction as to which providers can be used
  • Oracle JDK 11 will continue to include installers, branding, and JRE packaging, whereas OpenJDK builds are currently available as zip and tar.gz files
  • The javac –release command behaves differently for the Java 9 and Java 10 targets due to the presence of some additional modules in Oracle’s release
  • The output of the java –version and java -fullversion commands will distinguish Oracle’s builds from OpenJDK builds


Update : 25-Aug-2019



enter image description here

for more details oracle-vs-openjdk

2
  • Maybe you could put the information of the image here as a table instead? It takes on a lot of screen estate, and isn't really screen reader friendly. Also, the logo under Development being misaligned is bothering me a lot. Aug 4, 2023 at 13:03
11

A list of the few remaining cosmetic and packaging differences between Oracle JDK 11 and OpenJDK 11 can be found in this blog post:

https://blogs.oracle.com/java-platform-group/oracle-jdk-releases-for-java-11-and-later

In short:

  • Oracle JDK 11 emits a warning when using the -XX:+UnlockCommercialFeatures option,
  • it can be configured to provide usage log data to the “Advanced Management Console” tool,
  • it has always required third party cryptographic providers to be signed by a known certificate,
  • it will continue to include installers, branding and JRE packaging,
  • while the javac --release command behaves slightly differently for the Java 9 and Java 10 targets, and
  • the output of the java --version and java -fullversion commands will distinguish Oracle JDK builds from OpenJDK builds.
1
9

Aside from the obvious licensing difference, the major difference between OpenJDK and OracleJDK 11 are stability and performance updates.

Source: https://www.youtube.com/watch?v=Adv9--6IcQI&t=385

Every 6 months the two codebases will be in-sync. But during the 6 month window OpenJDK will only receive security updates while OracleJDK will receive additional stability and performance updates.

Given that update releases only occur every 3 months for both OpenJDK and OracleJDK this means that you are missing out on (at most) 3 months worth of fixes until the next major release comes out and you upgrade. However, if you choose to stick to LTS releases then a commercial license begins to make more sense.

6

Also for Java 8 an interesting performance benchmark for reactive (non-blocking) Spring Boot REST application being hosted on various JVMs by AMIS Technology Blog has been published in Nov 2018 showing that, among other differences:

  • OpenJDK has higher CPU usage than OracleJDK,
  • OpenJDK has slightly lower response time than OracleJDK,
  • OpenJDK has higher memory usage than OracleJDK,

For details please see the source article.

Of course YMMV, this is just one of the benchmarks.

5

OpenJDK

  • OpenJDK is opened source code, it is maintained and developed by Oracle, but allows communities and other companies to participate in this development, such as Red Hat, Azul Systems, IBM, Apple Inc, etc. OpenJDK is both a JDK product and a specification, any company or organization that wants to use OpenJDK to create a new variant must comply with those specifications. OpenJDK is developed by Oracle and the community contributions. We sometimes have issues on its stability; however, based on user feedback, it will be upgraded to perform better. OpenJDK is regularly updated, around every 6 months.

Oracle JDK

  • Oracle JDK is maintained and developed by Oracle. It complies with OpenJDK specifications, but it is not opened source code. Oracle JDK is much better in terms of the JVM responsiveness and productivity. It focuses more on the stability due to its importance to the corporate customers.

Source: https://o7planning.org/12571/history-of-java-and-the-difference-between-oracle-jdk-and-openjdk

2

My understanding is that Oracle JDK can't be used in production, therefore I cannot legally use it (without paying), for the web application I am building for my company. I have to use OpenJDK. Please correct me if I am wrong! From this article.

Starting with Java 11, the Oracle JDK is restricted to development and testing environments. Oracle JDKs may only be used in production if you buy the commercial support. Instead, Oracle will provide Java builds based on OpenJDK for free which can be used in production. But for the official Oracle JDK the real roadmap will look like this:

UPDATE: I'm wrong. I can use Oracle JDK for free but won't get security updates after 6 mos and we'll have to assume the risk. Look at the above linked article section "What does the new release train mean to my company?".

2
  • 2
    This may no longer be true as of JDK 13. There is a new license for Oracle JDK, according to Oracle: "The new license permits certain uses, such as personal use and development use, at no cost -- but other uses authorized under prior Oracle JDK licenses may no longer be available" . See oracle.com/downloads/licenses/javase-license1.html. Dec 16, 2019 at 17:08
  • Just wanted to know, Current release of oracle jdk8u241 is free for production use ?
    – Nirav Shah
    Feb 22, 2020 at 11:41
0

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. Moving forward, we intend 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 codebases.

· Yes, the garbage collection and other JVM parameters are the same.

· The performance of GC is the same in both.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.