Is Java Free? OpenJDK vs Oracle JDK Explained
Yes, Java is free β as long as you install the right distribution. The confusion arises because there are two main flavours: OpenJDK (free, open-source, GPL-licensed) and Oracle JDK (free for development and testing, but requires a paid subscription for commercial production use). Most developers and companies should use an OpenJDK build.
OpenJDK: the free reference implementation
OpenJDK is the official, open-source reference implementation of Java SE. It is released under the GPL v2 with Classpath Exception, which means you can use, modify and distribute it freely β including in commercial software β without paying anyone. Oracle itself develops OpenJDK and contributes the most code to it.
Several organisations build and distribute their own binaries from the OpenJDK source:
| Distribution | Vendor | Free for production? |
|---|---|---|
| Eclipse Temurin | Adoptium / Eclipse Foundation | Yes |
| Amazon Corretto | Amazon Web Services | Yes |
| Microsoft Build of OpenJDK | Microsoft | Yes |
| Azul Zulu | Azul Systems | Yes (community edition) |
| Liberica JDK | BellSoft | Yes |
| GraalVM Community | Oracle / GraalVM project | Yes |
| Oracle JDK | Oracle | No β requires Oracle Java SE subscription |
Oracle JDK licensing history (the short version)
Before Java 11 (2018), Oracle distributed a free Oracle JDK under the Binary Code License. From Java 11 onward, Oracle split: the free path is OpenJDK; the commercial path is Oracle JDK under the Oracle Technology Network License (OTNL). Starting with Java 17, Oracle introduced the "Oracle No-Fee Terms and Conditions" (NFTC) allowing free Oracle JDK use in production β but this licence expired for Java 17 in September 2024. The safest zero-cost choice for production is always a non-Oracle OpenJDK build.
What to install
For most developers and companies: install Eclipse Temurin from adoptium.net. It is the most widely used OpenJDK build, gets the same security patches as Oracle JDK, and is completely free for any use. Amazon Corretto is a sensible default if you are already on AWS.
How to verify you have the right one
java -version
Output from a free OpenJDK build looks like:
openjdk version "21.0.2" 2024-01-16
OpenJDK Runtime Environment Temurin-21.0.2+13 (build 21.0.2+13)
OpenJDK 64-Bit Server VM Temurin-21.0.2+13 (build 21.0.2+13, mixed mode, sharing)
Output from Oracle JDK looks like:
java version "21.0.2" 2024-01-16 LTS
Java(TM) SE Runtime Environment (build 21.0.2+13-LTS-58)
Java HotSpot(TM) 64-Bit Server VM (build 21.0.2+13-LTS-58, mixed mode, sharing)
The word OpenJDK vs Java(TM) SE is the tell. If you see Java(TM) SE and you are running it in commercial production, check your licence status.
Is the JDK the same as Java?
The JDK (Java Development Kit) includes the compiler (javac), debugger and development tools on top of the JRE (Java Runtime Environment). If you are writing Java code, install the JDK. If you only need to run compiled Java programs, a JRE is enough β though most free OpenJDK distributions now ship a JDK-only build, so just install the JDK and be done with it.