Tag Archives: how to install java on ubuntu

How to install Java 6 on Ubuntu 12.04

First, we will check that java is already install or not on our system:

java -version

As, we can see that the java is not install on our system, so we will downloads the Java binary installer from Oracle. (In this example, we will download & install the jre, but the procedure is exactly the same for jdk).

Transfer the downloaded file (jre-6u31***) to the Ubuntu from Windows machine using WinSCP.

Now, move to the directory where you copy the jre file(in my case, it is in tmp directory)

cd /tmp/

Give execute permission to jre file.

sudo chmod +x jre-6u31-linux-x64.bin

Run the jre file.

sudo ./jre-6u31-linux-x64.bin

After execution, it makes a new directory in the same location where jre file reside.

Move this newly created directory to /usr/lib/jvm/

sudo mv jre1.6.0_31 /usr/lib/jvm/

Enter this command:

sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jre1.6.0_31/bin/java" 1

We are done!

Check the installed version of java.

java -version

Confirmation (Optional 🙂 ):

Here is a confirmation that we successfully installed the java on Ubuntu 12.04.

Hope this will help you!

Please Remember me in your prayers!

%d bloggers like this: