How To Setup Java on Ubuntu 16.04
Image source: Pixabay free images
Java is a general-purpose computer programming language which is used from many software applications or websites.
Some Java applications require Oracle Java. This is my case. Here I describe the available solutions.
Use the following command to install OpenJDK
sudo apt-get install default-jre
Install Oracle Java
You can install Oracle Java
- using PPA repository
- with direct download
Personally, I prefer the second method.
Using PPA repository
sudo add-apt-repository ppa:webupd8team/java sudo apt-get update
sudo apt-get install oracle-java8-installer
Go to Oracle Downloads at section "Java Platform, Standard Edition" and click the current Java version. Download the JDK from the available options. In this example jdk-8u92-linux-x64.tar.gz (JDK 8u92 for Linux x64).
Move the dowwnloaded file to /opt. Then:
cd /opt tar xvzf jdk-8u92-linux-x64.tar.gz
sudo nano /etc/environment
Test your environment with the following command:
You may also be interested in