Install Oracle JAVA 8 on Ubuntu & LinuxMint Install Oracle JAVA 9 on Ubuntu & LinuxMint

Step 1 – Search OpenJDK Packages

OpenJDK packages are available under native apt repositories. You can simply use apt-cache search command to search the available java version for your Ubuntu system. As per above output, you can see openjdk-11-* and openjdk-8-* is available in the package manager.

Step 2 – Install JAVA (OpenJDK)

Use the below command to install OpenJDK on your Debian based systems using the package manager from the default repository. The below commands will install Java Development Kit (JDK) and Java Runtime Environment (JRE) both on your system. You can install JRE package only to setup Runtime Environment only. OpenJDK 11 OpenJDK 8

Step 3 – Configure Default Java Version

After installation of Java uses below command to verify the installed version of Java on your system.

Step 4 – Set JAVA_HOME

Its the best practice to set Java environment variable after installing java. To setup JAVA_HOME add following line to /etc/environment file, Path may be differ with your system architecture. Use the following command to check the environment value