Installing Sun Java on Ubuntu 10+

As of Ubuntu 10, users are encouraged to use OpenJDK instead of Sun Java JKD/JRE packages. OpenJDK generally works very well but every now and then you would need to install Sun Java. For example, schemaSpy returns errors with OpenJDK. To install Sun Java, do the following:

sudo apt-get install sun-java6-jdk sun-java6-jre sun-java6-plugin

If you get an "unable to locate package message", then you need to add the canonical repository. To do so, do the following:

sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"

and update to refresh the repository

sudo apt-get update

and the following to configure your packages to use Sun Java instead of OpenJDK

sudo update-alternatives --config java