Install Oracle Java (JDK & JRE) on Ubuntu

From Bonus Bits
Jump to: navigation, search

Purpose

This article gives the steps to Oracle Java 7 on Ubuntu 13.x Desktop. Not to be confused with OpenJDK.


Remove OpenJDK

sudo apt-get remove openjdk*


Add Repository

sudo apt-get remove openjdk*
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update

Example

You are about to add the following PPA to your system:
 Oracle Java (JDK) Installer (automatically downloads and installs Oracle JDK6 / JDK7 / JDK8). There are no actual Java files in this PPA. More info: http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html
 More info: https://launchpad.net/~webupd8team/+archive/java
Press [ENTER] to continue or ctrl-c to cancel adding it


Install Java 7

sudo apt-get install oracle-java7-installer


Install Java 8

sudo apt-get install oracle-java8-installer

Example

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  gsfonts-x11 java-common
Suggested packages:
  default-jre equivs visualvm ttf-baekmuk ttf-unfonts ttf-unfonts-core ttf-kochi-gothic ttf-sazanami-gothic ttf-kochi-mincho
  ttf-sazanami-mincho ttf-arphic-uming
The following NEW packages will be installed:
  gsfonts-x11 java-common oracle-java7-installer
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 160 kB of archives.
After this operation, 632 kB of additional disk space will be used.
Do you want to continue [Y/n]?


How to Uninstall

sudo apt-get remove oracle-java7-installer


Sources