Quick guide to download and install OpenJDK 12 on Ubuntu 18.04 / ubuntu 20.04. - OpenJDK Community Version
OpenJDK is the short form of Open Java Development Kit similar to Oracle's Java Development Kit used to develop Java Applications. Main difference between Oracle JDK and OpenJDK is that OpenJDK is free for all while Oracle Java Development Kit or Oracle JDK requires commercial license. For more details refer openjdk vs oracle jdk
If you want to know more about OpenJDK, you can go through Open Java Development Kit Quick guide.
Note: To uninstall previously installed OpenJDK please refer Uninstall openJDK Ubuntu 18.04 / ubuntu 20.04
Go to https://jdk.java.net/archive/ and download the OpenJDK 12 tar distribution openjdk-12+32_linux-x64_bin.tar.gz. Here is the quick lik to download the OpenJDK 12 tar file openjdk-12+32_linux-x64_bin.tar.gz
To Install OpenJDK 12 Java Runtime - Enter the below command on Ubuntu 18.04 / ubuntu 20.04 command line.
$ sudo apt-get install openjdk-12-jre
$ sudo apt-get install openjdk-12-jdk
Once the above steps are successfully completed , we need to set the "JAVA_HOME" and "PATH" environment variables. Enter the following commands to set your environment variables. Make sure that your environment variables point to a valid installation of JDK on your Ubuntumachine.
export JAVA_HOME=/usr/lib/jvm/openjdk-12-jdk
export PATH=$PATH:$JAVA_HOME/bin
Once the OpenJDK 12 Download and installation is complete, we can verify the installed OpenJDK 12 version using below Command.
Go to Ubuntu 18.04 / ubuntu 20.04 prompt and type java -version
The above command prints the OpenJDK 12 version you installed.
Java -version
$ java --version openjdk 12-ea 20**-03-** OpenJDK Runtime Environment (build 12-ea+18-Ubuntu-1) OpenJDK 64-Bit Server VM (build 12ea+18-Ubuntu-1, mixed mode, sharing)
Note: Here is the list of OpenJDK known-issues OpenJDK Known Issues
Here are the ubuntu openjdk packages you might be interested in!
Ubuntu package openjdk-8-jdk
Ubuntu package openjdk-9-jdk
Ubuntu package openjdk-11-jdk
Ubuntu package openjdk-13-jdk
Ubuntu package openjdk-14-jdk
Ubuntu package openjdk-15-jdk
If you are looking out for earlier OpenJDK versions, go to OpenJDK Archive