How to install java jdk on Ubuntu? here i provide few steps to demonstrate how it’s work.

Installation Setup

1 ) Issue following command to find out current jdk version in apt-get

apt-cache search jdk

2 ) Install java JDK and JRE with apt-get install

apt-get install sun-java6-jdk sun-java6-jre

3 ) Ubuntu will auto download necessary file from web for installation.

Do you want to continue [Y/n]? y
Get:1 http://my.archive.ubuntu.com hardy/main java-common 0.28ubuntu3 [78.2kB]
Get:2 http://my.archive.ubuntu.com hardy/multiverse sun-java6-jre 6-06-0ubuntu1 [6334kB]
Get:3 http://my.archive.ubuntu.com hardy/main odbcinst1debian1 2.2.11-16build1 [66.2kB]
Get:4 http://my.archive.ubuntu.com hardy/main unixodbc 2.2.11-16build1 [289kB]
Get:5 http://my.archive.ubuntu.com hardy/multiverse sun-java6-bin 6-06-0ubuntu1 [27.3MB] 
Get:6 http://my.archive.ubuntu.com hardy/multiverse sun-java6-jdk 6-06-0ubuntu1 [9625kB] 
85% [6 sun-java6-jdk 3208002/9625kB 33%]


4) After installation done, jdk and jre will install at /usr/lib/jvm/java-6-sun-1.6.0.06

5) Ubuntu help to create a java symbolic link and put in /usr/bin for shortcut access

4 ) type java -version, DONE !!

Post-Installation Setup

Set JAVA_HOME into environment variable

Copy following statement and append to /etc/profile or .bashrc file, make system set JAVA_HOME into system environment variable.

export JAVA_HOME="/usr/lib/jvm/java-6-sun-1.6.0.06"

P.S Please visit How to install JDK on Fedora Core, if you want to know how to install java jdk manually.