With so many versions and vendors available, choosing which JDK to use for a project can be frustrating. Due to multiple recent changes to Oracle licenses, there’s some confusion about what’s free and what requires a subscription.

To clear this all up, in this article you’ll learn the most important facts to help you choose the best JDK version and vendor for your project.

1. What is the JDK?

The JDK, the Java Development Kit, is a software package comprising the tools needed for developing and running Java programs.

Specifically, it contains:

  • Java compiler (the javac command)

  • other tools like jar and javadoc

  • JRE (Java Runtime Environment)

You’ll 100% need the JDK for developing Java applications. For example, your IDE needs to be configured with a specific JDK so it can compile code.

Here’s how that looks in IntelliJ IDEA:

Download JDK dialog in IntelliJ IDEA

Download JDK dialog in IntelliJ IDEA

You may also need to install the same JDK in testing and production environments to run your Java software. Although since Java 9 another option is to create your own minimal JRE from the JDK using JLink.

Clearly, knowing which JDK to choose is important, but unfortunately there’s no simple answer. Let’s get into some more details to help with your decision.

2. If Oracle makes Java, shouldn’t we use their JDK?

For many years Oracle provided their Oracle JDK, which most developers downloaded and used without issue in both development and production. This was the obvious, and perhaps only choice.

However, the landscape started to change from 2006 onwards, when Sun (later acquired by Oracle) started to make the JDK available as open source software.

This meant the OpenJDK project made the JDK codebase public and opened it up to external contributions from the likes of RedHat, BellSoft, Google, and others. Importantly, its license (GNU GPL license) meant that anyone could build their own JDK from the codebase and distribute it.

Oracle also provide builds of the Open JDK, known as Oracle Open JDK, that you can download. So just like the Oracle JDK, we can also use the Oracle OpenJDK to develop and run Java software.

But most developers had no reason to move away from the Oracle JDK, until Oracle made an announcement which took the Java world by surprise.

3. Does Oracle make you pay for its JDK now?

In 2017, developers were happily using Oracle JDK in development and production. But then Donald Smith, Oracle’s Senior Director of Product Management, came out with this this announcement

Oracle will continue to build and ship the Oracle JDK. Oracle JDK 8 will continue to receive public updates for at least the next year, and commercial support will be available through 2025. As OpenJDK binaries become the primary channel for developers to access the latest innovation in the Java SE platform, the Oracle JDK will remain as a long term support (LTS) offering for Oracle’s commercial and support customers.

Faster and Easier Use and Redistribution of Java SE from the Oracle blog

Although vague, this and further announcements lead to the conclusion that:

  • Oracle JDK could be used in production only by those who bought Oracle Java SE Subscription

  • Oracle JDK would still be free for personal and development use

  • free Oracle JDK 8 updates would end after 2018

At the time, with many systems running in production with Oracle JDK 8, these points became a big concern for many teams. Would the JDK somehow switch itself off one day?

The nightmare scenario Java teams were contemplating in 2019

The nightmare scenario Java teams were contemplating in 2019

Actually no.

The Oracle announcement only referred to future Oracle JDK builds. The new OTN license, restricting production use, would apply to Java 8 from version 8u211, to Java 11, and to any future Java versions. Although this turned out not to be not exactly the case, as you’ll learn shortly.

That meant you could continue to use older versions of Java 8 in production, but you wouldn’t receive critical security and other updates.

If you tried to download a JDK after April 2019, you’d get this warning.

The Oracle JDK 8 license changed in April 2019

The Oracle Technology Network License Agreement for Oracle Java SE is substantially different from prior Oracle JDK 8 licenses. This 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

…commercial license and support are available for a low cost with Java SE Subscription.

Warning on Oracle JDK 8 download page

It’s worth noting that at this point you could still use the latest versions of Oracle JDK 8 and 11 for personal and development use. Just not in production.

So what could we do? We still had the Oracle OpenJDK to fall back on, right?

4. What JDKs can I use for free?

Fortunately, at the time of the licensing changes in 2019 Oracle had for a while been releasing builds of its Oracle OpenJDK. These builds come from the same GitHub codebase as Oracle JDK, but critically are free to use, even in proudction, under a GPLv2+CPE license.

Problem solved?

Well, not exactly. The main sticking point is the JDK updates. These fix critical security vulnerabilities and other problems found in the JDK. If you use a JDK without these updates, then you leave your software open to all kinds of nasties.

Oracle only promises to update its OpenJDK builds until the next JDK release. In practice, that means you only have 1 month after the next JDK release to migrate your software over.

Oracle JDK & Oracle Open JDK free update periods, until Java 11

Oracle JDK & Oracle Open JDK free update periods, until Java 11

Worse still, the same rule even applies to long term support (LTS) releases of Oracle OpenJDK. Yes, if you’re on version 11, when version 12 is released you have to switch over straight away.

For some companies that’s OK. In fact, being able to move to the next JDK version fast could be a sign of a healthy development team. Other companies may need more time, though.

The only two options remaining at this point are:

  1. buy the Java SE Subscription and continue to receive Oracle JDK updates

  2. find another JDK. Maybe someone could offer an OpenJDK build with support?

Fortunately, with the vacuum created by Oracle, some kind people stepped in to plug the gap.

5. Who else offers OpenJDK builds besides Oracle?

Since Oracle would no longer be offering a JDK version with free updates beyond the release of the next major version, some other organisations stepped in to help out.

They created their own OpenJDK builds, using the same codebase as Oracle OpenJDK. Unlike Oracle though, they would commit to providing support for a longer time period, at least for the long term support (LTS) releases.

These LTS releases are now scheduled every 2 years:

  • current LTS releases include Java 8, 11, and 17

  • the next LTS release will be Java 21

Not only that, the other organisations creating OpenJDK builds (we’ll call them vendors) also promised continuing updates for Java 8 and Java 11 for many more years.

JDK build free update periods, from Oracle and other vendors, until Java 18

JDK build free update periods, from Oracle and other vendors, until Java 18

What does this mean? You can continue to use a 3rd party OpenJDK 8, 11, or 17 builds, confident in the knowledge that you will continue to get important updates.

So what choices of vendor do you have?

According to the JVM Ecosystem Report 2021, the most popular 3rd party JDKs used in production in 2021 were:

  1. Eclipse Temurin (formerly AdoptOpenJDK)

  2. Azul Zulu

  3. Amazon Corretto

All these are a good choice of JDK vendor. For more info on the specifics of the different vendor JDKs, visit whichjdk.com, which recommends Eclipse Temurin due to the involvement of many major organisations in the project.

6. Did something change in 2021 with the Oracle JDK license?

Yes. After initially deciding to make the Oracle JDK available only to paying customers from 2019 onwards, at least for production use, Oracle announced yet another change for Oracle JDK 17 onwards.

In September 2017, Oracle announced plans to distribute the JDK under the GPL as “Oracle OpenJDK” and also as the Oracle JDK under an Oracle Technology Network (OTN) license.

Providing Oracle OpenJDK builds under the GPL was highly welcomed, but feedback from developers, academia and enterprises was that they wanted the trusted, rock-solid Oracle JDK under an unambiguously free terms license, too.

Oracle appreciates the feedback from the developer ecosystem and are pleased to announce that as of Java 17 we are delivering on exactly that request.

From Introducing the Free Java License

Now they would be making the Oracle JDK free again. Yes, even for use in production!

Great news! So everyone jumped back to the Oracle JDK?

Well, not exactly. Actually, developers were fuming. After all the work they had put into moving away from Oracle JDK, they weren’t about to jump back any time soon.

Here are some poignant responses to the Reddit post And Oracle’s Java JDK (not OpenJDK) is free again…, which announced the news.

It was too late. By 2021, the Oracle JDK’s usage in production had already been relegated to 3rd place.

Putting any understandable resentment to one side though, should you switch back to Oracle JDK from Java 17 onwards?

It depends. But here are some points to consider:

  • LTS updates for 1 year after next LTS version: updates will be provided for LTS versions (including 17) for at least one full year after the subsequent LTS version. This is a much shorter time period than offered by the 3rd party JDK vendors. Can you switch to the next LTS version comfortably in one year?

  • No-Fee Terms and Conditions (NFTC) license: while the new license permits production use, it doesn’t allow redistribution for a fee. Or in other words, it doesn’t conform with the Open Source Definition. Is this good enough for your use case?

  • No IntelliJ IDEA support: within this popular IDE, you’ll notice in the Download JDK dialog you can’t select Oracle JDK. When someone requested to add this back in, given the recent license changes, the request was refused suggesting Please use AdoptOpenJDK builds instead. 😆

7. Is there a difference between Oracle JDK and Open JDK?

Oracle JDK and most OpenJDK builds are built from the same codebase. This means that functionally the differences are minor.

However, some 3rd party vendors do add extra features. For example, the BellSoft Liberica JDK includes JavaFX, which was removed from OpenJDK in Java 11.

For most of us with no special requirements though, the Oracle JDK and any OpenJDK build are functionally equivalent. In fact, Oracle makes available the Technology Compatibility Kit (TCK), a suite of over 100,000 tests used to validate a JDK build. All 3rd party JDK vendors mentioned in this article claim TCK compliance (Eclipse Temurin, Azure Zulu, Amazon Corretto, BellSoft Liberica).

The main differences to watch out for between Oracle JDK and Open JDK are licensing and updates, as already discussed.

8. Is it easy to switch JDK vendor?

Yes. If you pick one JDK vendor, you’re not wedded to them for life.

In fact, switching your JDK between one vendor and another, assuming the same version, should be seamless because they all pass the TCK.

This is an argument for not spending too long deliberating over which JDK vendor to go with. Pick one that generally meets your requirements, based on the above information, and know that you can always change it later.

So now that you’ve picked a JDK vendor, what about the Java version?

9. Which JDK version should I aim for?

New JDK versions are now released every 6 months, with a long term support (LTS) version every 2 years.

The main decision you have to make is to either:

  1. stay on the bleeding edge and benefit from new JDK utilities and language features (currently Java 18)

  2. ride the LTS wave for more time and flexibility (currently Java 17)

If taking the first option you’ll need to always upgrade within 1 month of the new JDK version to ensure you’re getting the latest security updates. For the second option, you stay on an LTS version until it’s superseded, then upgrade to the next LTS version within 1 year (or longer, depending on your vendor).

In real life things can be more complicated. Java 8 and 11 are still by far the most popular JDKs used in production at the moment.

With Eclipse Temurin promising updates to its OpenJDK 8 until at least 2026, it might be tempting for companies to stay on an older Java version. To me this seems like delaying the inevitable though. Eventually Java 8 will be so out of date that developers won’t want to work with it, preferring to use features from newer versions like sealed classes, records, and improved switch statements.

Ultimately the choice depends on factors specific to your project.

But if you’re working on a new project, the decision is simpler. Follow through this flow chart for my recommendation.

10. What JDK support options are available?

JDK support is different from updates.

  • support is the proactive assistance with specific issues you might be having

  • updates are the new JDK builds made available after specific bugs or vulnerabiilties are fixed

Support comes in 2 flavours, paid or free.

Here are the main paid options:

  • Oracle offer the Java SE Subscription, including 24/7/365 Java support. They prioritize bug fixes for you, and help customers tune their Java deployments for maximum performance.

  • Azul, the company behind Azul Zulu, also offer 24 hour support with their Azul Platform Core product

Note that in addition to support, these products may offer other benefits. For examplle, the Java SE Subscription offers access to Java Management Service, Advanced Management Console and GraalVM Enterprise.

If you don’t want to pay for support, you can still report a bug in Java at bugs.java.com. If you find a problem specific to a 3rd party OpenJDK build, you can report the issue directly to them.

For example, on the Amazon Corretto FAQ it suggests_:_

If you have a specific issue with Corretto or feature request that is not applicable to OpenJDK, please open an issue

11. Final thoughts

We’ve covered a lot here. You now have a clearer understanding of what different JDK versions and vendors are available, what are some of the positives and negatives of these, and how we came to be in this complicated situation in the first place.

The main takeaways from this article are:

  • don’t use Oracle JDK 8 or 11 in production, unless you buy Java SE Subscription

  • Oracle JDK is free in production again from Java 17 onwards

  • many good 3rd party OpenJDK builds are available, with longer update periods than Oracle JDK

  • stay on Java LTS versions to give yourself more time to update

Stop reading Gradle articles like these

This article helps you fix a specific problem, but it doesn't teach you the Gradle fundamentals you need to really help your team succeed.

Instead, follow a step-by-step process that makes getting started with Gradle easy.

Download this Free Quick-Start Guide to building simple Java projects with Gradle.

  • Learn to create and build Java projects in Gradle.
  • Understand the Gradle fundamentals.