Knowledge Base

An archive of my personal knowledge base.

Install Java (Oracle) on Linux Ubuntu

Cristian Sulea

Add partner repository:

sudo apt-get purge openjdk*

Update the source list:

sudo add-apt-repository "deb lucid partner"
sudo apt-get update
sudo apt-get install sun-java6-jre sun-java6-plugin

Install Sun's Java packages:

sudo update-alternatives -config java

Confirm that your system is configured properly for Sun's JRE (by checking the java version):

java -version


You can use WebUpd8 PPA (this will download the required files from Oracle and install JDK 8):

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

Also ensure your JAVA_HOME variable has been set to:


For this you can use the following command (see step 3 of Manual Install to see how to make it permanent):

export JAVA_HOME=/usr/lib/jvm/java-8-oracle


Share on Twitter