Technically What Is the Main Difference Between Oracle Jdk and Openjdk

Technically what is the main difference between Oracle JDK and OpenJDK?

Technical differences are a consequence of the goal of each one (OpenJDK is meant to be the reference implementation, open to the community, while Oracle is meant to be a commercial one)

They both have "almost" the same code of the classes in the Java API; but the code for the virtual machine itself is actually different, and when it comes to libraries, OpenJDK tends to use open libraries while Oracle tends to use closed ones; for instance, the font library.

Differences between Oracle JDK and OpenJDK

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

What is the reason to use OpenJDK?

November 2017: At the time this question was asked, the reasons for choosing between OpenJDK and Oracle JDK include:

  • Availability of builds / installers for specific platforms. For example, last time I checked there were no Oracle JDK distros in ".deb" format for Debian / Ubuntu. And no OpenJDK builds for Windows.

  • Oracle JDK has some commercial features that can be enabled by people who have paid. They are not present on OpenJDK.

  • Oracle JDK has an annoying click-through license. This is a pain if you are trying to automate deployment; e.g. to cloud VMs. By contrast, OpenJDK on Linux (at least) can be installed and updated using the platform's package manager.

  • There may be issues if you wanted commercial support for OpenJDK.

There were no substantive license differences between Oracle JDK and OpenJDK if you just plan to use the software. (There are some constraints on binary redistribution for Oracle JDK, but they are about shipping non-standard or stripped-down versions of the Java platform.)

In the future, some of these differences will go away, according to this blog page:

  • Faster and Easier Use and Redistribution of Java SE

Update in December 2018:

  • As of January 2019, Oracle JDK Java 8 will be EOL for commercial uses. (But free support will continue until January 2020 for personal use.)
    1

  • Java 9 and Java 10 are EOL.

  • Commercial uses of Oracle JDK Java 11 and later require a support contract or a subscription from Oracle. OpenJDK Java builds do not have this requirement.

  • Oracle do not provide support for OpenJDK Java builds, but support is available from 3rd parties. Third parties will also port Oracle security fixes to OpenJDK builds.

Further reading:

  • Java Is Still Free
  • OpenJDK Life Cycle and Support Policy (RedHat)
  • The future of Java and OpenJDK updates without Oracle support
  • What has changed in Java Release and Update Availability? (Azul Systems)
  • AdoptOpenJDK Support

1
EOL stands for end-of-life.
An end-of-life (EOL) product is a product that does not receive continuing support, either because existing marketing, support and other processes are terminated, or it is at the end of its useful life.

Technical difference between AdoptOpenJDK and Red Hat OpenJDK for Windows

Red Hat provides OpenJDK 8 Windows binaries under exactly the same license as AdoptOpenJDK and any other open-source OpenJDK 8 build - under the GNU GPL v. 2 with classpath exception. All the restrictions about the "development use" are related only to the subscription (support) that can be purchased from Red Hat.

Technical differences between Red Hat OpenJDK 8 for Windows and other mentioned builds are pretty minor, as all these builds pass TCK. Generally Red Hat builds are trying to stay as close as possible in behaviour to OpenJDK 8 package that is included in RHEL and CentOS.

Differences:

  1. RH OpenJDK 8 build is done from the sources of OpenJDK RPM package that is used on RHEL/CentOS. These sources are generally very close to upstream sources, but contain some changes (see points below) and may include some bugfixes (RPM patches) ahead of time. RHEL/CentOS changes can be tracked in a publicly-available repo for CentOS RPM

  2. RH OpenJDK 8 includes Shenandoah garbage collector

  3. RH OpenJDK 8 uses sources from RHEL/CentOS for dependency libraries (zlib, giflib, libjpeg-turbo, libpng, nss (nss is not used anymore)) instead of the (partial) sources of these libraries that are included in-tree in upstream jdk sources

  4. Elliptic Crypto implementation in RH OpenJDK 8 includes only 3 most popular elliptic curves - NIST P-256, NIST P-384 and NIST P-521.

  5. RH OpenJDK 8 uses the set of root CA certificates from RHEL/CentOS

  6. RH OpenJDK 8 may use slightly newer timezone data - it is taken from RHEL/CentOS

  7. RH OpenJDK 8 includes all Java sources code inside the src.zip file (that is used by IDEs to allow browsing jdk code), in upstream build substantial part of these sources is not included

  8. RH OpenJDK 8 does not include demos and samples

  9. RH OpenJDK 8 includes a set of font files

  10. all native binaries in RH OpenJDK 8 are signed by RH certificate

  11. RH OpenJDK 8 installer includes a JavaFX implementation

  12. RH OpenJDK 8 installer includes a WebStart implementation

Source: I work on OpenJDK Windows builds at RH.

Difference between OpenJDK and Adoptium/AdoptOpenJDK

In short:

  • OpenJDK has multiple meanings and can refer to:
  • free and open source implementation of the Java Platform, Standard Edition (Java SE)
  • open source repository — the Java source code aka OpenJDK project
  • prebuilt OpenJDK binaries maintained by Oracle
  • prebuilt OpenJDK binaries maintained by the OpenJDK community
  • AdoptOpenJDK — prebuilt OpenJDK binaries maintained by community (open source licensed)

Explanation:

Prebuilt OpenJDK (or distribution) — binaries, built from https://hg.openjdk.java.net/, provided as an archive or installer, offered for various platforms, with a possible support contract.

OpenJDK, the source repository (also called OpenJDK project) - is a Mercurial-based open source repository, hosted at
https://hg.openjdk.java.net. The Java source code. The vast majority of Java features (from the VM and the core libraries to the compiler) are based solely on this source repository. Oracle have an alternate fork of this.

OpenJDK, the distribution (see the list of providers below) - is free as in beer and kind of free as in speech, but, you do not get to call Oracle if you have problems with it. There is no support contract. Furthermore, Oracle will only release updates to any OpenJDK (the distribution) version if that release is the most recent Java release, including LTS (long-term support) releases. The day Oracle releases OpenJDK (the distribution) version 12.0, even if there's a security issue with OpenJDK (the distribution) version 11.0, Oracle will not release an update for 11.0. Maintained solely by Oracle.

Some OpenJDK projects - such as OpenJDK 8 and OpenJDK 11 - are maintained by the OpenJDK community and provide releases for some OpenJDK versions for some platforms. The community members have taken responsibility for releasing fixes for security vulnerabilities in these OpenJDK versions.

AdoptOpenJDK, the distribution is very similar to Oracle's OpenJDK distribution (in that it is free, and it is a build produced by compiling the sources from the OpenJDK source repository). AdoptOpenJDK as an entity will not be backporting patches, i.e. there won't be an AdoptOpenJDK 'fork/version' that is materially different from upstream (except for some build script patches for things like Win32 support). Meaning, if members of the community (Oracle or others, but not AdoptOpenJDK as an entity) backport security fixes to updates of OpenJDK LTS versions, then AdoptOpenJDK will provide builds for those. Maintained by OpenJDK community.

OracleJDK - is yet another distribution. Starting with JDK12 there will be no free version of OracleJDK. Oracle's JDK distribution offering is intended for commercial support. You pay for this, but then you get to rely on Oracle for support. Unlike Oracle's OpenJDK offering, OracleJDK comes with longer support for LTS versions. As a developer you can get a free license for personal/development use only of this particular JDK, but that's mostly a red herring, as 'just the binary' is basically the same as the OpenJDK binary. I guess it means you can download security-patched versions of LTS JDKs from Oracle's websites as long as you promise not to use them commercially.

Note. It may be best to call the OpenJDK builds by Oracle the "Oracle OpenJDK builds".

Donald Smith, Java product manager at Oracle writes:

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.



OpenJDK Providers and Comparison




























































































































ProviderFree Builds
from Source
Free Binary
Distributions
Extended
Updates
Commercial
Support
Permissive
License
Website
AdoptOpenJDKYesYesYesNoYeshttps://adoptopenjdk.net
Amazon – CorrettoYesYesYesNoYeshttps://aws.amazon.com/corretto
Azul ZuluNoYesYesYesYeshttps://www.azul.com/downloads/zulu/
BellSoft LibericaNoYesYesYesYeshttps://bell-sw.com/java.html
IBMNoNoYesYesYeshttps://www.ibm.com/developerworks/java/jdk
jClarityNoNoYesYesYeshttps://www.jclarity.com/adoptopenjdk-support/
OpenJDKYesYesYesNoYeshttps://adoptopenjdk.net/upstream.html
Oracle JDKNoYesNo**YesNohttps://www.oracle.com/technetwork/java/javase/downloads
Oracle OpenJDKYesYesNoNoYeshttps://jdk.java.net
ojdkbuildYesYesNoNoYeshttps://github.com/ojdkbuild/ojdkbuild
RedHatYesYesYesYesYeshttps://developers.redhat.com/products/openjdk/overview
SapMachineYesYesYesYesYeshttps://sap.github.io/SapMachine

Is Oracle JDK not an open source project?

But [the Oracle] JDK source code is openly available and free. Right?

Strictly speaking, No.

1) The full source code for the Oracle JDK is not available. The JDK source code ZIP file only contains the source code for the public class library APIs. Not some of the "internal" class. Not the JDK / JRE toolchains. Not the JVM runtime itself; e.g. the JIT compiler, GC implementations, the verifier, etc.

2) For the subset that is available you need to accept an Oracle license.

3) The source code that is available says in the copyright headers that it is Oracle (or Sun) proprietary.

So how come its not open source?

See above.

May be i am wrong here because source code may be available and free but is it not allowed to modify/extend and redistribute it further, that why it is not open source ?

That is one reason.

Open source doesn't just mean that source code is available for free. It it also available without undue restrictions on what you can do with it.

(And if you want the full source code for Oracle JDK, then it is not available for free, and the terms and conditions are pretty restrictive.)


By contrast the OpenJDK codebase is covered by GPLv2 (with the "Classpath exception" which clarifies the point that an application built to use the OpenJDK JVM / class libraries is not subject to the GPL.) Everything that is part of OpenJDK is available as source code ... without you signing anything.

Sure the GPL places restrictions on what you can do, but those are designed to make the code free (as in liberty) and protect the rights of the end-user.



Related Topics



Leave a reply



Submit