OpenJDK 18 is an open-source distribution of Java SE Development Kit (JDK), released on March 22nd 2022. JDK 18 is a feature release as of Java SE’s 6-month release cadence - it’s not a LTS (Long Term Support) release.
In this post, I’d like to guide you how to download and install OpenJDK 18 on Windows operating system.
Click this link to visit the official download page of OpenJDK 18. Then click on the Windows/x64 zip link to download the binary distribution of OpenJDK 18, as shown below:
You’ll get the file openjdk-18_windows-x64_bin.zip downloaded. But before installation, you should verify the integrity of this file. Open a new command prompt window, change the current directory to the one containing the file. Then type the following command:
certutil -hashfile openjdk-18_windows-x64_bin.zip sha256
Compare the returned SHA256 checksum against the one published in the sha256 link (next to the zip link). If they are the same, you can proceed to install OpenJDK 18 safely.
Extract the downloaded zip file into a separate directory, e.g. D:\OpenJDK18. Then you need to update the system environment variables JAVA_HOME and PATH in the following way:
JAVA_HOME = D:\OpenJDK18\jdk-18
PATH = JAVA_HOME\bin + PATH
Open a new command prompt window with administrator privilege, and type the following commands:
setx -m JAVA_HOME "G:\OpenJDK18\jdk-18"
setx -m PATH "%JAVA_HOME%\bin;%PATH%";
Then open another command prompt to verify OpenJDK 18 installation. Type the java -version and javac -version commands:
If you see the result like this, that means you have successfully installed OpenJDK 18 on your Windows computer.