Choosing a JDK Provider
07 Dec 2021One of the side effects of the open nature of the JDK and wide JDK development community is that we have an important-feeling decision to make early in the life of a Java project - which JDK to use?
Most other languages don't really have this issue, because there's either one obvious place to get your dev environment (e.g. C#) or because the choice is pretty dependent on your target hardware/OS (e.g. C).
With Java, you can choose a JDK from a large (and growing) group of organisations, almost all of which are "free" (for various definitions) and all of which are compatible (at least until you get deep into optimisations).
Here I'll discuss some of the more likely options you'll want to consider when choosing a JDK to install and base your project on. It won't be exhaustive and undoubtedly won't be a perfect match for your situation, but hey, it's somewhere to start.
For those who really feel the need, you can also get the source and make your very own JDK: download the source, give it a new name, build it, slap it on your machines, you're a JDK provider
Side note: This post came about following a few chats with colleagues about choosing a JDK for an old (Java 8) codebase which needed resurrecting and supporting. So I thought it was worth writing things down for when I forget what I'd said.
You want: Adoptium Temurin
Please don't ask me about the name. It used to be fairly obvious - "Adopt OpenJDK" - which was used all over various documents, blogs, articles, etc as the name of the JDK on which the wider Java community could depend for a stable and well maintained dev environment.
Then it was absorbed into the Eclipse Foundation (which is probably a good thing) and renamed to something no one associates with anything 😢
This is basically the user-friendly option, they've got basic installers and versions for most environments and situations you'll want.
You want: The one your cloud provider supports
Most cloud providers have created their own JDK, based on the OpenJDK source, so that they can apply patches and config updates at their own pace and for their chosen support periods. This is a good thing (assuming you trust them to actually do the support/maintenance work) and means you can probably roll Java support into the overall cloud support agreements.
- Amazon AWS: Corretto
- Microsoft Azure: Microsoft Build of OpenJDK (snappy name eh?)
- Oracle OCI: Java SE JDK (the one you probably recognise)
- Google GCP: Free choice, no direct support
- RedHat OpenShift: Red Hat build of OpenJDK (another snappy name)
A few things to note in that list:
- Oracle's JDK is the only one with "Java" in the name - a whole bunch of copyright wrangling means they kept the name for their own products.
- Microsoft used to recommend Azul's Zulu JDK for their cloud, but recently produced their own. I've no idea why.
- Google GCP doesn't recommend any specific JDK, but they do link to some open and well supported ones: Temurin (as above), Zulu (see other note) and OpenJDK (the reference implementation)
There are other cloud providers (and cloud framework providers).
If they don't have a preferred JDK that they support, you can either pay another JDK provider for their support, or use Temurin and trust to the stability of Java and the size of the support community
You want: Oracle Java SE Development Kit
Recently Oracle has started Playing Nicely (â„¢ probably) with the Java community. In the past Oracle's easily found JDK download was a non-free version which had quite expensive license fees attached and included some tools which silently increased your license obligations even further.
With the expanding set of other high quality and well supported JDK implementations, Oracle found their JDK was basically not getting used. To make things worse for them, their installer included a UI click-thru for the license agreement, which meant lights-out and automated installs for things like containers and VMs were either impossible or a real pain to set up. So even those teams who had the relevant licenses didn't install their JDK.
From Java 17 they've changed to the Oracle No-Fee Terms and Conditions license, which means we're free to use it in dev and production.
Oracle is still happy to take your money if you want a pay-for license though.
The subscription gives you access to support channels, access to patches for older Java versions and access to various enterprisey features which you may want.
It also gives rights to use a bunch of clever GraalVM optimisation features, which I'm still hoping to learn more about at some point.
You want: OpenJDK (for the binaries)
This is the "source of truth" for Java. This is what the OpenJDK community produce, for all the community members, and others, to build upon. These binaries are the reference output from building the reference implementation of Java. If you absolutely need to confirm that your JDK is correct, this is the one. It's also deliberately just a restricted set of installers and associated tooling.
You want: The github source
If you're the kind of folk who build cars from parts catalogues and build your Linux distros from Gentoo and Slackware - then this is the route for you.
But really, you probably don't need this unless you need to set up some seriously deep debugging sessions. Or you are customising Java for your own needs - in which case please don't confuse everyone (Microsoft, I'm looking at you and your J# nonsense).
You want: Azul Zulu
This is a self-indulgent section - I wanted this, no one else asked me about it. Basically I wanted a Debian repo which contains the latest JDK releases so I can easily use "apt install jdkNN" to install new JDK versions and "apt update; apt upgrade" to update my existing JDKs with the latest patches. Surprisingly Zulu turned out to be exactly that, it's worked very smoothly so far and I've written a little more about that in a separate post: Modern Java on Debian-ish boxes
What kinds of things need considering (apart from the stuff covered above) when choosing your JDK?
The good news is that, apart from picking the newest possible stable version (i.e. 17 if you can, 11 if you must and 8 if you're forced to while an upgrade is in progress) you're probably just looking at what support agreements you need in place for production. In some cases you may also have specific performance needs or unusual hardware/firmware architecture, but in those cases you'll know more about what you need than I can cover here.
All the providers have a set of versions they support and usually a longer set of versions they make available for archive/legacy purposes. Adoptium have said they'll try to maintain support for the widest sensible set of versions, but that support only covers providing downloads and patches.
If you need support for ancient JDKs (like 8) then some providers (notably Oracle) will provide paid support for quite a long period (Oracle will support Java 8 until 2030, longer than they're promising to support Java 11). Other providers have said they'll keep applying patches and updating their downloads for as long as they can (Adoptium and Coretto have said "at least until" 2026).
If you need prehistoric JDKs (earlier than 8), you may need to hunt around and accept the lack of available support.
Also - start upgrading really soon (like, get it on your task board, get the time scheduled). There's a bunch of security updates, bugfixes, certificate renewals, and world info changes (timezones, countries, currencies, etc)
There may be specific support requirements and contractual terms of the project/product you're working on which will drive your choice of JDK. Luckily, this may completely remove the need for you to decide on a JDK/JRE - especially for the production machines - since you'll follow whatever rules are stated in those contract terms.
Oracle has traditionally been seen as the expensive and quite draconian support license approach, so if you're using older Java versions (especially 8) then it's worth taking care to read the license and make sure you're only using their JDK on machines you wish to pay the licensing for.
For most of the cloud providers, you basically have a free choice if you're running & supporting your own JREs, but they'll probably recommend using their own JDK, at their provided versions, for full support. That support should include the provider automatically patching their JDKs and JREs and providing regular container/VM updates.
If you're installing and managing your own JDKs/JREs in production, you'll want the patching and upgrading process to be as simple and automated as possible. Java has a reputation for being installed and forgotten in corners of data centres, so please be kind to future maintainers.
For non-production environments, there's usually more liberty to choose different JDKs; but in general at least use the same version of Java on non-production as on production. Later JDKs can be told to compile as for an older version of the language (e.g. in theory you could use a Java 17 JDK to compile Java 8 source code for a Java 11 JRE). So if you're feeling brave, you could use JDK 17 on dev machines to build older code for older JREs - but you'll want a really good CI/CD pipeline to build and test it all rigorously on the right versions before production deployment.
However, the good news is that all the various JDKs should be based on the reference source from OpenJDK, so using Temurin JDK 17 on dev machines, Oracle SE JDK 17 on test machines and Corretto JDK 17 on your production cloud should be reasonably safe - assuming you're patching them all vaguely in sync.
See the above section about Oracle's "freebie" JDK. The license situation has changed quite a bit over the past few years - mainly for the better.
If you're using Java 17, you shouldn't need to incur any costs for non-production JDKs and can choose which provider and support requirements you need to pay for in production.
Not really. Try to match the JDK version you're using on production to the version you're using in dev and you should be good in the vast majority of cases.
No, all good on this - unless you're starting to make use of the very new and fancy GraalVM enterprise features.
The core code for Oracle's JRE and OpenJDK's JRE should be identical, so there shouldn't be any actual code changes to make any risks/mitigation work should be confined to 3 main considerations:
- performance - if the app is highly optimised with some tight resource boundaries, there can be differences between how JREs perform
- build/deploy tooling - basically some names and command flags might be slightly different in some cases
- Garbage Collector choices - some providers include their own GC implementations which you may want to use for specific performance cases
From Java 8 onwards, OpenJDK has been the reference version of Java and other orgs (including Oracle) can build their own distributions of it and charge (or not) for those.
However, Oracle did choose to charge for their most easily found JDK. If you are using the "standard" Oracle Java 8 JDK, then you may want to switch to another Java 8 JDK, at least for your non-production machines, to avoid licensing issues.
The only reasons to use Oracle's Java 8 JDK is for support/licensing reasons (i.e. you want an Oracle engineer on the end of the phone for when production falls over or need to tick a "have got paid support" box for a contract)
For the techies, there's a command to see which vendor your Java came from:
java -XshowSettings:properties -version 2>&1 |grep 'java.vendor\|java.vm.vendor'
You'll see "Oracle Corporation" if using the Oracle Java 8 JDK. If that reads "AdoptOpenJDK" (or other non-Oracle org) for all production Javas, your Oracle license audits should be happier.
Note that some JDK providers didn't update both bits of the config file when they built their own JDK (OpenLogic, I'm looking at you) - so you may see a mix of "Oracle Corp" and "Not Oracle Corp" in the output.