Just to summarise the information I got from
http://www.webupd8.org/2011/03/install-java-in-ubuntu-1104-natty.html
and
http://ubuntuforums.org/showthread.php?t=471488
in order to get Sun's Java Development Kit (JDK) up and running under Ubuntu (I'm using 11.04).
You may use Synaptic (the package manager) to add the "Canonical Partners" repository, reload, then find and install sun-java6-jdk.
Otherwise, open a terminal session and type the following:
sudo add-apt-repository "deb http://archive.canonical.com/ maverick partner"In case you had OpenJRE, OpenJDK, GCJ or similar (free, OSS Java alternatives) already in your system you may want to ensure Sun's JRE & JDK are the default. Still using the terminal, type:
or
sudo add-apt-repository "deb http://archive.canonical.com/ natty partner"
...depending on whether you have Ubuntu maverick (10.11) or natty (11.10). Then add:
sudo apt-get update
sudo apt-get install sun-java6-jdk
sudo update-alternatives --config javaand select your preferred alternative from the list. To select a Java compiler, type
sudo update-alternatives --config javacNow on to the testing. You should get the version numbers of the currently installed and default runtime and compiler by typing (in the terminal):
java -version...and that should be it.
javac -version
I'd recommend you to use Geany as a source editor/IDE.