Installing Java SDK/Tomcat to Ubuntu Feisty (Part 1)

When I first got my slice, I had it setup with java and tomcat. Apparently, I updated or rebuilt my slice and forgot to install those two again. Too bad I didn't take good notes because I totally forgot how to do it. So this time, I'm going to document it via this post. I am currently running Ubuntu Feisty (v. 7.04). You can find out what version you're running by running the following command:
cat /etc/issue
The usual apt-get command allows me to install sun-j2re1.4. That's not very helpful if I want to compile java code off of my slice or set it up to be a continuous build server. I remember that I had to add a specific repository in order to be able to install the Java SDK via apt-get. After some digging around, I came up with the following:
sudo vi /etc/apt/sources.list
Paste the following into the file:
deb http://archive.ubuntu.com/ubuntu feisty universe multiverse
deb-src http://archive.ubuntu.com/ubuntu feisty universe multiverse
The Ubuntu docs recommend enabling the universe/multiverse security/updates repositories to prevent version mismatches during installs or upgrades but I didn't run into any issues proceding without them. Save and exit out of vi. Next, run
sudo apt-get update
apt-get should be pulling down an updated list of installable packages. So if you type
sudo apt-get install sun-j
and then hit TAB, you should get a list of installable sun packages. I decided to install Java 6.0 SDK.
sudo apt-get install sun-java6-sdk
It will begin to download and install the SDK. You will have to accept a license. Just hit TAB to get select "OK" and hit enter. Once it completes, you should be able to confirm the JDK was installed successfully.
>> javac -version
javac 1.6.0
The next post will lay out steps to install Apache Tomcat.