The latest versions of Oracle JDK, available under the Oracle No-Fee Terms and Conditions License, can be downloaded from a command line, or automatically in scripts and dockerfiles by using download URLs which will deliver the then current update release.
For example, to retrieve the current JDK 20 update release for Linux x64 as a compressed (tar.gz) archive, you can use the wget
command:
wget https://download.oracle.com/java/20/latest/jdk-20_linux-x64_bin.tar.gz
curl
:
curl https://download.oracle.com/java/20/latest/jdk-20_linux-x64_bin.tar.gz
https://download.oracle.com/java/20/latest/jdk-20_linux-x64_bin.tar.gz.sha256
These URLs will deliver the GA version of JDK 20 and its checksum until the release of the first Critical Patch Update. When 20.0.1 is released the above URLs will deliver 20.0.1 until the release of the 20.0.2 at which point the above URLs will deliver 20.0.2 and so on.
URLs for all versions available under the Oracle No-Fee Terms and Conditions License are supported.
There are several OS, architecture, and packaging options available. The following table lists them as they are spelled in the permanent URLs:
Operating Systems | Architecture | Packaging Options |
---|---|---|
linux | aarch64 | rpm, tar.gz |
x64 | deb, rpm, tar.gz | |
macos | aarch64 | dmg, tar.gz |
x64 | dmg, tar.gz | |
windows | x64 | exe, msi, zip |
For a complete list of scriptable JDK URLs visit https://www.oracle.com/javadownload
If rather than the latest update of a release you want to download a particular version, there are corresponding archive URLs that will start working on the day on which that version is released. The archive URLs use the full version number on the filename to be released and have the word archive instead of latest in the path.
For example:
To download the GA version of JDK 17 you can use:
https://download.oracle.com/java/17/archive/jdk-17_linux-x64_bin.tar.gz
for the GA version of JDK 20 you can use:
https://download.oracle.com/java/20/archive/jdk-20_linux-x64_bin.tar.gz
for 17.0.1 version you can use:
https://download.oracle.com/java/17/archive/jdk-17.0.1_linux-x64_bin.tar.gz
for 20.0.1: (this link will start working only after 20.0.1 is released in April 2023)
https://download.oracle.com/java/20/archive/jdk-20.0.1_linux-x64_bin.tar.gz
The archive releases also have corresponding archive URLs for the checksum.
For example, to retrieve the checksum for jdk-17.0.1_linux-x64_bin.tar.gz
visit:
https://download.oracle.com/java/17/archive/jdk-17.0.1_linux-x64_bin.tar.gz.sha256
Here is a fraction of a sample docker file that will download the current JDK 17 version as a tar.gz, check the download against it’s checksum, and extract it to /usr/java/jdk-17
ENV JAVA_PKG=https://download.oracle.com/java/17/latest/jdk-17_linux-x64_bin.tar.gz \
JAVA_HOME=/usr/java/jdk-17
RUN set -eux; \
JAVA_SHA256=$(curl "$JAVA_PKG".sha256) ; \
curl --output /tmp/jdk.tgz "$JAVA_PKG" && \
echo "$JAVA_SHA256 */tmp/jdk.tgz" | sha256sum -c; \
mkdir -p "$JAVA_HOME"; \
tar --extract --file /tmp/jdk.tgz --directory "$JAVA_HOME" --strip-components 1
The complete Dockerfile is available in Oracle’s docker image repository in GitHub. The container image created with this Dockerfile is available in the Oracle Container Registry.
The JDK 20 latest URLs will work until JDK 20 is superseded by JDK 21 in September of 2023.
The JDK 17 latest URLs will work for as long as an up-to-date version of JDK 17 is available under the Oracle No-Fee Terms and Conditions License. After September 2024, three years after GA and one year after the next JDK LTS release is available, the latest JDK 17 URLs will cease to work. Java SE Subscribers will be able to continue getting updates for JDK 17; other users should migrate to the next LTS.
The archive URLs for each release will continue to work for at least a year after the corresponding latest URLs stop being available.