Pages

Installing Java on Ubuntu


This post will tell you about  How to install the Java on Ubuntu system. Many new user feel difficulty to install Java on Ubuntu system.In this post I will tell you some easy steps to install Java on Ubuntu. 




Note: The following command is tested on bash shell.

1. First step is to check the bit version of your Ubuntu operating system
    by typing the following command on your terminal -

$ uname -a

If the output of commnad is like-

Linux pointer 3.2.0-51-generic-pae #77-Ubuntu SMP Wed Jul 24 20:40:32 UTC 2013 i686 i686 i386 GNU/Linux

Then you have 32bit version of Ubuntu.

And if the output of command something like-

Linux pointer 3.2.0-51-generic-pae #77-Ubuntu SMP Wed Jul 24 20:40:32 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

Then you have 64-bit version of Ubuntu.

2. Download the tar ball of your Java version according to your bit version (32 bit vesion 0r 64 bit version of Java) of Ubuntu.

from the given URL -



3. Extract the Java using the command
$ tar -xvzf/Download/jdk1.7.0_25.tar.gz -C /usr/local
//change the location of ~/Download/jdk1.7.0_25.tar.gz from your downloaded location of Java.
4. Set the location of bin directory of Java to PATH environment variable. This step is necessary to make command like java, javac, javadoc executables from any directory without having to type the full path of command,otherwise you will have to write full path to access these command like -
$ /usr/local/jdk1.7.0_25/bin/java
To set the path type the following command on terminal-
sudo gedit /etc/environment
And add the the path of bin directory like
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/local/jdk1.7.0_25/bin"

5.Set JAVA_HOME variable in /etc/profile file.
$ sudo gedit /etc/profile
Add the following line at the and of the file,
JAVA_HOME=/usr/local/jdk1.7.0_25


6. Source the file /etc/profile and /etc/environment to make change effective

source /etc/profile $ source /etc/environment


7. Now type java and javac command from any directory to check weather Java is successfully install or not.

No comments:

Post a Comment