Saturday, 9 August 2014

How to install JDK 8 on Ubuntu?

| Saturday, August 09, 2014 | | |


install JDK 8 on Ubuntu
JDK 8 on Ubuntu
When setting up JDK 8 or any other version in Windows platform you are required to set PATH environment variable manually. In case of Ubuntu, you can skip that step and everything will work jut fine.

Install JDK 8

Oracle JDK 8 stable version was released on 18th of March, 2014.

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

Check Java Version

To check the version of Java. just check the version of java tool. To get a complete set of options just type java in terminal and hit enter.

$ java -version

java version "1.8.0_11"
Java(TM) SE Runtime Environment (build 1.8.0_11-b12)
Java Hotspot(TM) 64-Bit Server VM (build 25.11-b03, mixed mode)

Check Javac tool version

$ javac -version
javac 1.8.0_11

How to switch to JDK 7?

$ sudo update-java-alternatives -s java-7-oracle
To switch back to JDK8,
$ sudo update-java-alternatives -s java-8-oracle

What if OpenJDK is also installed?

No, need to worry. After installing JDK 8 via ppa, it will get set as default. But, if openJDK is installed then, while trying to switch back to JDK 7, the above command will not work.

Related Posts with Thumbnails

No comments:

Post a Comment