How-To: Install the Official Sun JDK in Ubuntu

Update: I wrote this to switch out the JRE in Ubuntu 10.04, and it’s still valid & works in Ubuntu 10.10 =D

The default java solution for Ubuntu 10.04 is the OpenJDK virtual machine and the IcedTea plugin for firefox – but I’ve been having serious issues with it locking up, taking up 100% CPU and other such craziness – so I’ve switched over to the (proprietary) official Sun JDK, and things are working much better. Here’s how I did it, and how you can too…

1.) Add the Lucid Partner repository to your Sources list

We’re going to be installing the Sun JDK through the repos, and it just so happens that we need the partner repo enabled, so you can either add the following line to your /etc/apt/sources.list, or you can check the box in System | Administration | Software Sources (assuming you’re using Gnome – pick whatever source managing front-end KDE uses if that’s your poison):

or..

Sun JDK Add Repo

2.) Install the Sun JDK and Plugin

Before you install the good stuff, it’s an idea to check your current version so you can see the changeover’s worked. To do this, just run java -version from bash and you should see something like this:

Once you know what you’ve currently got, again from the shell, enter the following to install the official Sun JDK (don’t worry about multiple JDKs being installed – we deal with that later):

During this process you’ll have to agree to the license agreement – just hit Tab to switch focus in the text window onto the Yes button (assuming you do agree), and hit Enter to accept.

JRE EULA
The JRE EULA - Slap the Tab key followed by Enter to ensure swift installation and that Oracle (they bought Sun, remember?) now own your first born child...

3.) Remove the old OpenJDK stuff

In Synaptic, you want to fully remove the following packages (if they’re installed – the top three in the below list might not be):

If you do this before installing the Sun JDK, all packages depending on Java will be removed as well – so in this rare instance, later is better, and any packages depending on Java can now stay on the system.

4.) Check it all works

From the command line enter: java -version and you should see the new details:

If you want the new plug-in to take effect in Firefox or such you need to restart the browser, then you should be all good to go! Maybe test it out at sodaplay for kicks too :)

Cheers!

Leave a Reply

Your email address will not be published.