Saturday, November 30, 2013

Install Java JDK 7 on Ubuntu 12.04

I install the  package which provides by Oracle Java JDK 7 including JRE, the Java browser plugin and JavaFX.  I followed several step to configure Java JDK that is mention bellow:

1. To add our PPA and install the latest Oracle Java (JDK) 7 in Ubuntu, use the commands below:


                                 sudo add-apt-repository ppa:webupd8team/java
                                 sudo apt-get update && sudo apt-get install oracle-jdk7-installer

2. After the installation you have enable the jdk:

                               update-alternatives --display java

3. Check if Ubuntu uses Java JDK 7

                               java -version

If all went right the answer should be something like this:

                              java version “1.7.0_07″
                             Java(TM) SE Runtime Environment (build 1.7.0_07-b10)
                             Java HotSpot(TM) Server VM (build 23.3-b01, mixed mode)

The version can be vary and don't worried about it. This may be upper than my version.

4. Check what compiler is used:

                            javac -version

The correct answer should be like this:
                           
                          javac 1.7.0_07

5. Adding JAVA_HOME to environment
                          
                          Edit /etc/environment and add JAVA_HOME=/usr/lib/jvm/java-7-oracle to the end of the file.

First open a Terminal (Applications → Accessories → Terminal), Or just press Ctrl+Alt+t, then enter:

                       sudo gedit /etc/environment

Append to the end of the file:

                       JAVA_HOME=/usr/lib/jvm/java-7-oracle

6. Uninstalling Oracle JDK 7
                            If you want to uninstall the Java JDK, then follow the bellow command:

                      sudo apt-get remove oracle-jdk7-installer
          

No comments:

Post a Comment