You can download it from here for free:
And here comes the one-liner:
The command above downloads the OpenJDK 10 from adoptopenjdk.net (you can specify the source and type with -s and -t), extracts it, applies the latest time zone data from IANA by downloading, extracting and calling the latest time zone updater (you have to accept the Oracle license by specifying the -a option) and it saves .version files that store the URI of the actual download for re-run purposes (see below). In /opt/java/jdk/ you will then find symlinks that point to the latest latest updated OpenJDK 10 folder (and the latest tzupdater.jar if you run the script with -z). Now you have a fixed path that you can use to configure your IDE, apps, whatever.
URL=https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.4%2B11/OpenJDK11U-jdk_x64_linux_hotspot_11.0.4_11.tar.gz sudo ./update_jdk -az -s $URL -t openjdk10 /opt/java/jdk/
If you re-run the script above, it will only download the bits if they are different from those that you have downloaded already (it simply compares the .version file), updates the JDK that you have specified with -t and recreates the symlinks. So with the update_jdk script you stay up to date the easy way.
$ /opt/java/jdk/openjdk10_latest/bin/java -version openjdk version "10.0.1-adoptopenjdk" 2018-04-17 OpenJDK Runtime Environment (build 10.0.1-adoptopenjdk+10) OpenJDK 64-Bit Server VM (build 10.0.1-adoptopenjdk+10, mixed mode)
Update Aug 24, 2018:
bash-dwarfs has been renamed to bashberries
Update Sep 23, 2018:
update_jre has been renamed to update_jdk
Update Oct 13, 2019:
Option -s requires an exact URL that points to a JRE/JDK tarball, because it appears that the filenames on the servers are too volatile and future changes to them cannot be predicted.