Oracle Java 8 JDK – Java Development Kit – apt-get install method
Silent install Java 6/7/8/9 using WebUpd8 team’s PPA
sudo apt-get install -y python-software-properties debconf-utils sudo add-apt-repository -y ppa:webupd8team/java sudo apt-get update echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | sudo debconf-set-selections sudo apt-get install -y oracle-java8-installer
OpenJDK
You can use this Java open source installation when Oracle licensing causing limitations.
sudo add-apt-repository ppa:openjdk-r/ppa sudo apt-get update sudo apt-get install openjdk-8-jdk -y
Oracle Java 7 JDK – zip file install
This will treat how to install Oracle Java in Ubuntu. This method does not use any package management software. Use a link in the references section for other options.
Download the 32-bit or 64-bit Linux from “http://www.oracle.com/technetwork/java/javase/downloads/index.html” “compressed binary file” – it has a “.tar.gz” file extension.
Uncompress it
tar -xvf jdk-7u80-linux-x64.tar.gz (32-bit) tar -xvf jdk-7u80-linux-x64.tar.gz (64-bit)
The JDK 7 package is extracted into ./jdk1.7.0_80 directory.
Now move the JDK 7 directory to /usr/lib
sudo mkdir -p /usr/lib/jvm sudo mv ./jdk1.7.0_80 /usr/lib/jvm/
Optional: Environment variables
$ sudo vi /etc/environment #add environment variables system wise, all users PATH="search/paths:/usr/lib/jvm/jdk-oracle/bin" JAVA_HOME=/usr/lib/jvm/jdk-oracle
Log log out and log back in, you should have Java available to you now.