Installing Sun Java SE 6, Apache Maven 2 and Tomcat 5 on Ubuntu GNU/Linux

First go to System -> Administration -> Software Sources and make sure that the multiverse and universe Ubuntu repositories are enabled on your system.

Installing Java SE 6, Apache Maven 2 and Apache Tomcat 5.5 software is just one simple command on Ubuntu family of GNU/Linux operating systems:

# sudo aptitude install sun-java6-jdk tomcat5.5 jetty maven2

I recommend setting JAVA_HOME environment variable to point to the JDK installation directory in your profile file(e.g. .bash_profile or /etc/profile):

export JAVA_HOME /usr/lib/jvm/java-6-sun

The above command also installs the jetty web server which is especially good for development purposes.