What is the reason to use OpenJDK?

21,170

Solution 1

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:


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:


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.

Solution 2

Other Answers are correct. Here is some other information as well, including vital changes as of early 2021.

Source-code versus Binaries/installers

understand the differences between Oracle JDK and Open JDK.

To sum it up: source-code versus binaries/installers.

  • OpenJDK is an open-source project, implementing the Java Specifications, JSRs, and JEPs that define the Java platform. This project publishes only source-code, not binaries or installers to get Java running on your computer (except for some early-access builds). Oracle is the principal participant in the OpenJDK project, alongside IBM & Red Hat, Apple, SAP, Azul Systems, Microsoft, and others.
  • Many companies provide distributions of OpenJDK for installation, as binaries or installers. Oracle is one such company.

Oracle actually provides two such products:

  • Oracle JDK
    A commercial product, with paid support plans. (Free-of-cost only for development & testing, not deployment. Read their terms.)
  • jdk.java.net
    A build of the OpenJDK source-code, freely available, unsupported.

Oracle has declared their intention to keep their commercial product Oracle JDK at feature-parity with OpenJDK. Oracle even went so far as to open-source and make available at no cost their formerly commercial tools Mission Control and Flight Recorder, both now a part of OpenJDK. So there is nearly no practical difference. One significant difference is that the Oracle company reserves the right to rapidly supply their paid support customer base with urgent patches not currently found in OpenJDK. Ditto for other vendors selling support.

[And for the record, Oracle offers a third implementation of Java, GraalVM, which is a very specialized product.]

Here is a flowchart graphic I made to help guide you in selecting a provider of a Java implementation.

Flowchart guiding you in choosing a vendor for a Java 11 implementation

And here is a list of motivations you might consider in choosing a distribution.

Motivations in choosing a vendor for Java

Solution 3

OpenJDK comes tightly integrated with the distribution update process. For example, on Fedora, this means that you simply can run

dnf update

without activating third-party repositories, and you will get the latest OpenJDK version with all relevant fixes.

OpenJDK is tested by the distribution vendor on this particular distribution. Oracle has different reference platforms for testing of OpenJDK. In the case of Fedora, software written in Java is tested with the OpenJDK version provided by the distribution, while the combination of that software with Oracle JDK receives much less testing.

Oracle also bundles their Java downloads with additional software such as browser toolbars, performance measurement and monitoring tools.

Solution 4

For those, who read this in 2019.

Java SE 8 is the last Java SE release targeting Desktop deployment (eg, Java Web Start and a stand-alone system JRE). Java SE 8 will be end of public updates in January 2019, after which commercial users need to either transition to other technologies, or purchase a Java SE Subscription.

So, another reason to use OpenJDK (in addition to what Stephen C said): it's free of charge for all purposes.

Share:
21,170

Related videos on Youtube

Turkhan Badalov
Author by

Turkhan Badalov

Updated on July 13, 2022

Comments

  • Turkhan Badalov
    Turkhan Badalov almost 2 years

    I somehow understand the differences between Oracle JDK and Open JDK.
    But I can't find reasons to use Open JDK.
    Because Oracle JDK already has everything one would need and sometimes faster than Open JDK.

    In which cases should someone use Open JDK?
    Is it just for legality issues?
    If yes, then what are issues?
    That because I have been still develop all my projects using Oracle JDK

    • Boris the Spider
      Boris the Spider over 6 years
      There is no difference any more. OpenJDK is OracleJDK since Java 9 GA.
    • Turkhan Badalov
      Turkhan Badalov over 6 years
      @BoristheSpider, thank you very much for the article. I understood that Oracle tries to eliminate technical differences. But I still don't understand what cases prevent me from using Oracle JDK? Or the reason to use Open JDK instead Oracle JDK. If they provide same features and completely same, then what is the reason to separate implementations? Oracle could just make its code open and available.
    • Boris the Spider
      Boris the Spider over 6 years
      They have done exactly that. That is what the article says.
    • Turkhan Badalov
      Turkhan Badalov over 6 years
      @BoristheSpider, where did you see this? The article just states: "Starting with JDK 9 GA Oracle plans to ship OpenJDK builds under the GPL" and "Oracle will also open source commercial features such as Java Flight Recorder previously only available in the Oracle JDK". But it doesn't state that Oracle JDK is now open source. What am I missing?
    • Basil Bourque
      Basil Bourque over 4 years
      @TurkhanBadalov Oracle releases two products, both based on OpenJDK source code: (a) their commercial product Oracle JDK which may vary from OpenJDK such as having rapidly updated patches, and (b) their freebie built directly from OpenJDK codebase. See my Answer for more details.
  • Turkhan Badalov
    Turkhan Badalov over 6 years
    Sorry maybe for obvious for others questions. But what do you mean by "distribution update process"? What distribution are you talking about? And what do you mean by "distribution vendor"? All people who work on Open JDK?
  • Florian Weimer
    Florian Weimer over 6 years
    People usually use OpenJDK as provided by Debian/Red Hat/SuSE/Ubuntu. All this probably does not make much sense if you are on Windows. (Your question does not say this.)
  • Turkhan Badalov
    Turkhan Badalov over 6 years
    I use Fedora. Why doesn't it make sense for Windows? Does Windows have special rights on this? I don't know even what I am missing.
  • Florian Weimer
    Florian Weimer over 6 years
    Windows and MacOS are the only major operating system where the vendor does not distribute OpenJDK, so the trade-offs are different.
  • RTHarston
    RTHarston about 4 years
    Brilliant charts sir. This deserves buckets of upvotes. The difference between source code and installer is what made it all click for me.
  • Basil Bourque
    Basil Bourque almost 4 years
    OpenJDK is just source code, not a product, not a binary or installer. So you cannot actually use OpenJDK, unless you are doing your own build.
  • madhead
    madhead almost 4 years
    That's true. So, you either pay Oracle for binaries and support, or you choose an OpenJDK flavor and use it. Either it's an OS-provided package (like in in Linux), or a pre-built binary, like Amazon Coretto that you can download and use. Or self-built. In all the cases you have no Oracle support, and, thus, don't pay for it.
  • Basil Bourque
    Basil Bourque almost 4 years
    You missed my point. Your Answer is incorrect. (A) You cannot “use OpenJDK”, you can only use a product built from the source code provided by the OpenJDK project. (B) Your claim that any product built wholly or partially from the OpenJDK source code is always free-of-charge is not true. Some vendors provide a product free-of-charge and some charge a fee, as indicated in the flowchart in my answer. Oracle is not alone in charging a fee.
  • madhead
    madhead almost 4 years
    I can use OpenJDK and I use it. Here are the OpenJDK builds by, I guess, Oracle: jdk.java.net/14. The links look like: download.java.net/java/GA/jdk14.0.1/…. It looks like an OpenJDK build, huh? Here is another link, a list of Java flavors for Jabba. There are a lot of different OpenJDK builts there: from Amazon, from Alexey Shipilev, etc. There are Oracle builds there as well, but they need a license
  • madhead
    madhead almost 4 years
    And I never claimed that "any product built wholly or partially from the OpenJDK source code is always free-of-charge is not true". Oracle's builds definitely use OpenJDK codebase, and they are not free. What I'm claiming is that in some point of time in the past, Oracle began charging it's customers for using their proprietary builds. And that's another reason to switch from them to some OpenJDK flavors. Moreover, as I've said in the previous command, Oracle indeed provides their own free OpenJDK builds, but they lack of support.
  • madhead
    madhead almost 4 years
    Oracle Java SE Support Roadmap clearly specifies the differences between "Oracle JDK" and "OpenJDK builds from Oracle".
  • madhead
    madhead almost 4 years
    And of course I can build OpenJDK from the source and use it. Who will stop me?
  • Basil Bourque
    Basil Bourque almost 4 years
    Not quite correct/up-to-date regarding OpenJDK for Java 8. Oracle is currently (2020-07) providing updates for Oracle JDK for Java 8 to the public free-of-charge for non-production use. This will continue indefinitely, at least through 2021. Oracle promises to give notice 18 months in advance of discontinuing these updates. Paying customers continue to receive support for the same product. See the official Oracle page, Oracle Java SE Support Roadmap. Java 8 gives new meaning to the phrase “long-term support (LTS)”.
  • Sachin Joseph
    Sachin Joseph about 3 years
    Wonderful answer! Btw, Microsoft also maintains an OpenJDK build nowadays: devblogs.microsoft.com/java/…