Thursday 18 June 2015

How to install Java on Ubuntu and Updates Java on Ubuntu


How to install Java on Ubuntu and Update it.


Add the webupd8team Java PPA repository in your system and install Oracle Java 8 using following set of commands.

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

After successfully installing oracle Java using above step verify installed version using following command.

$ java -version

java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)

Configuring Java Environment:

In Webupd8 ppa repository also providing a package to set environment variables, Install this package using following command.
$ sudo apt-get install oracle-java8-set-default

If you need the latest Oracle Java 6, you install it too:
sudo apt-get install oracle-java6-installer

If you need the latest Oracle Java 6, you install it too:
sudo update-java-alternatives -s java-7-oracle

If you want test Oracle Java 9 early access builds, you can install it too:
sudo apt-get install oracle-java9-installer

4 comments: