How to install Java in Ubuntu using Terminal. Command to install Java 8 on Ubuntu 16.10 and Ubuntu 16.04 Systems using ppa:webupd8team/java. The tutorial explains how to install JDK (Java Development Kit) and JRE (Java Runtime Environment) on Linux Ubuntu Systems.
- JDK (Java Development Kit) – The OpenJDK project is an open-source implementation of the Java SE Platform. This is the default version of Java that is provided from a supported Ubuntu repository.
- Oracle Java – Oracle Java is the proprietary, reference implementation for Java. This is no longer currently available in a supported Ubuntu repository.
Install Java on Ubuntu 16.10
Run the following commands to install Java JDK (Java Development Kit), JRE (Java Runtime Environment) and Java browser plugin on Ubuntu 16.10 and Ubuntu 16.04 Systems.
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install java-common oracle-java8-installer
Please note that during the Java installation process, you will be asked to accept the Oracle license.
Choosing Default Java to Use
If Linux Ubuntu system has more than one version of Java, you can manually select and configure which Java version is to be used by the system. To do so, run the command:
sudo update-alternatives --config java
The above command lists choices for the alternative java (providing /usr/bin/java). Press enter to keep the current choice[*], or type selection number: 1