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 http://archive.canonical.com/ 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

JDK 8

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:

/usr/lib/jvm/java-8-oracle

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

Resources

Share on Twitter