Today, I'll try to explain the way how to install the latest Oracle Java JDK 8 and 7.
Pre-requisites
Ubuntu 12.02 or aboveProcedure
We can install in two ways- Using PPA
- Manual Installation
PPA installation
- Open terminal from "Applications" or press key combination "Ctrl+Alt+T"
- Type the following commands in sequence
- $ sudo apt-add-repository ppa:webupd8team/java
- $ sudo apt-get update
- To install latest JDK 8, type the following command
- $ sudo apt-get install oracle-java8-installer
- To install latest JDK 7, type the following command
- $ sudo apt-get install oracle-java7-installer
- Once the download complete, it will ask for agree for terms and conditions
- Click on "OK" to complete the installation
Manual Installation
- Download the Oracle JDK from the following official link
- Extract the downloaded zip (Example "jdk-1.8.0.25.tar.gz")
- It will create a folder with name "jdk-1.8.0.25"
- Create a folder "java-8-oracle" under "/usr/lib/jvm" folder
- $ sudo mkdir -p /usr/lib/jvm/java-8-oracle
- Move the folder contents to /usr/lib/jvm/java-8-oracle
- $ mv jdk-1.8.0.25/* -rf /usr/lib/jvm/java-8-oracle/
Configure the java executables
Configuration can only be done if more than one JDK is installed.To configure java execute the following command
$ sudo update-alternatives --config javaExample output if Java 7 and Java 8 installed
There are 2 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/java-7-oracle/jre/bin/java 2 auto mode
1 /usr/lib/jvm/java-7-oracle/jre/bin/java 2 manual mode
* 2 /usr/lib/jvm/java-8-oracle/jre/bin/java 1 manual mode
Similar way you can do for javac, javaws and other executables
Configure javac
$ sudo update-alternatives --config javacConfigure javaws
$ sudo update-alternatives --config javawsHappy java coding guys :)
References
- http://askubuntu.com/questions/121654/how-to-set-default-java-version
- http://askubuntu.com/questions/521145/how-to-install-oracle-java-on-ubuntu-14-04
- http://askubuntu.com/questions/56104/how-can-i-install-sun-oracles-proprietary-java-jdk-6-7-8-or-jre
Please send your feedback and comments to psrdotcom@gmail.com
No comments:
Post a Comment