Note: The following command is tested on bash shell.
1. First step is to check the bit version of your linux/ubuntu operating system
by typing the following command on your teminal-
$ uname -a
If the output of commnad is like-
Then you have 32bit version of ubuntu.
And if the output of command somethin like-
Then you have 64-bit version of ubuntu.
2. Then download the tar ball ofyour java version according to your bit version(32 bit vesion 0r 64 bit version of java) of os
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.
To set the path type the following command on terminal-
sudo gedit /etc/environment
And add the the path of bin directory like
5.Set JAVA_HOME variable in /etc/profile file.
$ sudo gedit /etc/profile
Add the following line at the and of the file,
$ source /etc/profile
$ source /etc/environment
7. Now type java and javac command from any directory to check weather java is succesfully install or not.
Tags: Installing java on linux/ubuntu,how to install java in ubuntu,how to install java 8 on ubuntu,ubuntu install oracle java,ubuntu install openjdk 8,how to install java in ubuntu using terminal,download java for ubuntu,sudo apt-get install oracle-java8-installer,sudo add-apt-repository ppa:webupd8team/java,unable to locate package oracle-java8-installer