Install Oracle Java 8 on Ubuntu
Posted on Oct 24, 2017 (last modified May 7, 2021)
How to install Oracle Java 8 on Ubuntu (in my case, Ubuntu 16.04 LTS)
Procedure to install Oracle Java 8 on Ubuntu
You probably want to confirm first that a version of Java is not already installed. If so, you can do that with the java -version command as shown below…
developer@ubuntu:~$ java -version
The program 'java' can be found in the following packages:
* default-jre
* gcj-5-jre-headless
* openjdk-8-jre-headless
* gcj-4.8-jre-headless
* gcj-4.9-jre-headless
* openjdk-9-jre-headless
Try: sudo apt install
developer@ubuntu:~$
Change to root…
sudo su -
(enter password)
apt-get install software-properties-common
add-apt-repository ppa:webupd8team/java
apt-get update
apt-get install oracle-java8-installer
Check if Java is successfully installed
java -version
java version "1.8.0_111"
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)
Procedure to uninstall
If, for some reason, you want to undo this operation and uninstall Oracle Java 8 from Ubuntu, you can then execute the following:
sudo su -
sudo apt-get remove oracle-java8-installer