If you are a Java developer or a beginner, who just installed Ubuntu 12.04 LTS (Precise Pangolin) then JDK (Java Development Kit) is the first thing you want to install (although you might consider installing these essential things too).
In the previous version of Ubuntu, sun-jdk was also available – in 12.04 you might install it from an external PPA but it’s not recommended better try open-jdk or oracle-jdk (Oh!, I don’t recommend this either). So this post might help you in setting up Java development environment on Ubuntu 12.04 LTS.
Although, this post explains only about JDK but you may like to setup Eclipse (Most Popular IDE for Java programmers) IDE and Java server environments like Apache Tomcat, JBOSS or whatever depending on your project.
Installing JDK on Ubuntu 12.04 (Precise Pangolin)
In official package, v 6 as well as 7 is available. So if you’re already working on a project then you would obviously go for that, otherwise latest version is recommended. JDK includes default JRE(Java Runtime Environment) according to the version, and other dependencies. If you don’t like command line interface then better go for synaptic package manager (above snapshot).
Install OpenJDK 7
sudo apt-get install openjdk-7-jdk
Install OpenJDK 6
sudo apt-get install openjdk-6-jdk
Update1 : Synaptic Package Manager snapshots added!