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…….


3 responses to this post.

  1. Generally I do not read post on blogs, but I wish to say that this write-up very pressured me to try and do so!
    Your writing style has been surprised me. Thank you, quite nice post.


  2. Hello There. I found your blog the use of msn.
    This is a very well written article. I’ll be sure to bookmark it and return to learn extra of your helpful information. Thanks for the post. I’ll definitely comeback.


  3. Posted by Siddhanta on May 21, 2013 at 2:56 am

    Very Nice work


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: