gist JS

Thursday, November 06, 2008

ubuntu slicehost sun java apt-get

So as part of the ToCollege.net migration from GoDaddy to SliceHost I had the 'opportunity' to learn a new linux distro. After some going back and forth about whether I really felt like doing this and with much reassurance from the assorted linux-heads I decided to take the ubuntu plunge. 

Reassured that apt-get was the indeed the new hotness, I proceeded to attempt the very difficult and subtle and arcane process of... installing java. Easy right?

That's what I thought. Turns out that the open-sources freakos in Ubuntu land are so fixated on free software, that installing Java on Ubuntu is not painless. (Yes I know you thought Java was free, but it turns out it's not free enough to qualify as really free, or something like that. I quite frankly don't care.) 
Long story short, you need to update your source list. Anyway, you might think that adding 'universe' to the list of apt-get sources would be good enough to tell apt that you don't care about the useless OpenJDK, go get me the real Sun JDK, but you'd be wrong. You'd be wrong, because universe actually isn't the largest scope.

But what's bigger than the universe? Well, for standard window/mac user's maybe the universe is as big as it gets, but in Linux land the new hotness is... 'multiverse'

Yes I do know what the multiverse is. Yes I did read Timeline. Yes it is neat. But no, this should not be a prereq for installing Java. The next person who tells me linux is ready for desktop users everywhere gets punched in the nose.

vim /etc/apt/sources.list
add 'multiverse' to the end of all of the strings.

sudo apt-get update
sudo apt-get install sun-java6-jdk

Then, if you were unfortunate enough to get tricked into installing the OpenJDK in your fruitless struggle to get this working.

sudo update-java-alternatives -s java-6-sun

To test that everything is no longer rogered:

java -version

You're looking for something akin to the following.

java version "1.6.0_06"
Java(TM) SE Runtime Environment (build 1.6.0_06-b02)
Java HotSpot(TM) 64-Bit Server VM (build 10.0-b22, mixed mode)