Posts Tagged ‘jdk’

Installing Java manually on Ubuntu

Hello everyone!!!!! This is my very first blog post. Also today marks  a very special day in my academic life. It is the first day of  my  intern ship period  at AdroitLogic, where I was inspired to write this blog 🙂

So I thought of starting off with a very very basic thing. Of course most of you people might have already  done this several times, but still there may be few guys out there struggling to do this, just like I did today 😀

Java can be installed on ubuntu easily using the apt -get install command , but here I’ll be explaining how to install java with  the tarball compressed file (jdk-7u7-linux-x64.tar.gz)file, which can be downloaded from here.

1. Open a terminal and log in as he super user and change the current directory to tmp (this is because all in tmp will be erased in the next system reboot, we will be extracting the bin file into the tmp folder)

sudo su
cd /tmp

2. Change the permission type of the tarball to executable by the owner

chmod +x /home/amindri/Downloads/jdk-7u7-linux-x64.tar.gz

3. Unpack the tar ball file.

tar -zxvf  /home/amindri/Downloads/jdk-7u7-linux-x64.tar.gz

Do a ls -l to see if the bin file is properly extracted

4. Move the extracted file to the desired installation folder. In my case it will be opt

sudo mv jdk1.7.0_07 /opt

5.  Go in to the opt folder and add a symbolic link to the jdk folder.

cd /opt
ln -s jdk1.7.0_07 jdk

6. The .bashrc file should be edited to set the environmental variables. The .bashrc file  can be edited via the vi editor, if you are not very familiar with it just gedit it.

cd or cd ~ (you need to be in here to open the .bashrc file via command line)
gedit .bashrc

7. The file will be displayed. Append these two lines to  the very end of the file

export PATH=/opt/jdk/bin
export JAVA_HOME=/opt/jdk

8. Set the class path –  again gedit the /etc/environment and set the path as follows

export JDK_HOME=”/opt/jdk”

Rather than using apt -get install, this manual installation provides you with the flexibility of choosing the installation folder and  I think it’s quite an exiting procedure.

P.S: The advantage of adding a symbolic link is, when you update the java version, it is not necessary to update all the environmental and path variables. All the variables hold value “jdk”, it is quite sufficient to add just a new symbolic link to the jdk .

So have fun with installing java manually on Ubuntu…….