Installation of openjdk 7

I am installing openjdk-7 on my Ubuntu 10.04 server
But I find it to be difficult.

I am new to Ubuntu.
I have installed the python software properties as suggested by some advice I saw online and have uncommented these two lines:

deb http://archive.canonical.com/ubuntu oneiric partner
deb-src http://archive.canonical.com/ubuntu oneiric partner0

Also i have done these two successfully:

sudo add-apt-repository ppa:openjdk/ppa
apt-get update

apt-get install openjdk-7 is not working as I expect.


Solution 1:

The correct command is apt-get install openjdk-7-jdk, this is the command for you to install jdk,

for other options, from which I mean doc, jre, source, try pressing tab after openjdk-7- and apt will autocomplete it for you..

Solution 2:

The following command should install jdk, jre ..

apt-get install openjdk-7-jdk

In case you had previous version of the java installed you have to update your java configuration and set openjdk-7-jre to be your auto (default) using the following command.

sudo update-alternatives --config java