Multiple ways to install Java on Ubuntu

You have two options available for installing Java on an Ubuntu system. You can choose one of them.

#1. How to Install Default Java on Ubuntu with Apt-get

This is the simple and quick way to install Java on Ubuntu systems. Run the following commands to install Java on an Ubuntu Linux system. JDK also contains JRE packages but you can install the default-jre package and install JRE only. You can also install the specific Java version on your system using one of the following commands.

#2. How to Install Oracle Java on Ubuntu using PPA

The second options are to install Oracle Java. The Debian packages are not available for Oracle Java, but the Webup8 team has provided you with an easier way to install Oracle Java on an Ubuntu system. Add the following PPA to your system: Java 8 is the LTS release available and Java 9 is the latest release available for installation. Now install the Java version of your choice as below.

Configure Default Java with Alternatives

The update-alternatives command is used for configuring the default version for your system. The systems have multiple Java versions installed can use the below command to set a specific Java version as the default

Type the selection number of Java version you want to set as default Java on your Linux system.

Easy way to Install Java on Ubuntu   TecAdmin - 19