Wednesday 6 February 2013

How to Install Oracle JDK 7 on Ubuntu 12.10 Linux

To install Oracle JDK 7.0 on Ubuntu linux machine, follow the steps mentioned below:

1. Download Oracle JDK setup from here.

2. Once the download is complete, uncompress the file using following command:
 tar -xvf <File downloaded in step 1>
3. JDK 7 package is extracted into ./jdk1.7.0_02 directory. - Now move the JDK 7 directory to /usr/lib
sudo mv ./jdk1.7.0_02 /usr/lib/jvm/jdk1.7.0 
4. Now Run following commands in the Terminal one by one.
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0/bin/java" 1 
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.7.0/bin/javaws" 1 
5. Once above three commands has been executed then run following command.
 sudo update-alternatives --config java 
You will see output similar one below - choose the number of jdk1.7.0 - for example 2 in this list:
There are 2 choices for the alternative java (providing /usr/bin/java). 
 Selection      Path                                                              Priority       Status
-----------------------------------------------------------------------------------------------------------------------------  0           /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java     1071          auto mode  1           /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java      1071          manual mode *2           /usr/lib/jvm/jdk1.7.0/bin/java    1        manual mode
6.Repeat the step 5 for below commands
sudo update-alternatives --config javac
sudo update-alternatives --config javaws
 Now, JDK 7 has been successfully installed on your Ubuntu 12.10.

You may also like to read..

No comments:

Post a Comment