Installing Java 8 on Ubuntu

Quick notes about installing Java 8 on Ubuntu 12.4 LTS. Option 2 is almost same for RHEL 7.1.

Option 1:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer

This unfortunately did not install the latest from Java for me so I moved to option 2 in may case but if it works for you, it is very easy to use that package and update.

Option 2: Manually

Download package from Oracle-Java site and extract it with tar. Then;

sudo mv jdk1.8.0_72 /usr/lib/jvm/

sudo update-alternatives –install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.8.0_72/jre/bin/java" 1
sudo update-alternatives –set java /usr/lib/jvm/jdk1.8.0_72/jre/bin/java


sudo update-alternatives –install /usr/lib/mozilla/plugins/ /usr/lib/jvm/jdk1.8.0_72/jre/lib/amd64/ 1
sudo update-alternatives  –config

And if needed;

sudo update-alternatives –install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.8.0_72/bin/javac" 1
sudo update-alternatives –install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.8.0_72/jre/bin/javaws" 1


To choose versions;

sudo update-alternatives –config java
sudo update-alternatives –config javac
sudo update-alternatives –config javaws

Good luck.

Bulent Tolu

Bulent Tolu

Sr. Systems Engineer at VMware
Bulent is an IT professional with Master's in MIS and 10-years of experience in broad range of Information Technologies. He is exposed to engineering/architecting, implementation/integration, and administration of various high-available IT systems and infrastructure. He has a passion to continually research, test and evaluate new technologies and follow industry best practices to secure and optimize IT systems. Currently, he lives in Istanbul and works as a Sr. Systems Engineer at VMware.
Bulent Tolu

Leave a Reply

Your email address will not be published. Required fields are marked *

Post Navigation

Translate »