Wednesday, 31 July 2013

Setup JDK7 in Ubuntu Linux

In this article, we will see how to setup JDK7 in Ubuntu 12.04.

1. Download latest version of JDK7.

You can download the latest version of JDK7 from here.

Download the file jdk-7u25-linux-i586.tar.gz for 32 bit machines and  jdk-7u25-linux-x64.tar.gz for 64 bit machines

Note : The version number (7u25) may be different in your case.


2. Extract the downloaded file to any directory by issuing the given below command in a terminal


Terminal
$tar -xvzf jdk-7u25-linux-x64.tar.gz


Now a directory called jdk1.7.0_25 will be created in the current directory

3. Update PATH environment variable to include JDK7

Append the given below lines to the file </path/to/your-home-directory>/.bashrc. The file ".bashrc" is a script file, which will be executed on opening the terminal.

File :.bashrc
PATH=$PATH:<path/to/jdk1.7.0_25>/bin

export PATH



4. Run the script file .bashrc to make an immediate effect

Terminal
$ .  </path/to/your-home-directory>/.bashrc


5. Test the installation


$java -version


Outputs the installed version number ( java version "1.7.0_25" )  in a terminal.