HOWTO: Install Sun’s JDK on Ubuntu (without the Command Line)

Written on 20 July 2011

The Java Development Kit (JDK), which is required to write applications in Java, is not included by default in the Ubuntu Linux OS. Various guides (such as this one) will give you a succinct set of commands to run from the terminal to download and install Sun’s (now Oracle’s) official JDK. But, probably because it’s harder to explain, none show you the slightly more user-friendly point-and-click way of doing it. Well, this page does.

Open the Ubuntu Software Centre, located in your Applications menu. The app will open, but no matter what you search for, you won’t get Sun’s JDK. This is because it has been moved to Ubuntu’s “Partner” repository, which is not enabled by default. We will now enable it.

Go to the Edit menu, and click _Software Sources…
_

You’ll be prompted to enter your password, so do that:

In the box that appears, go to the Other Software tab. You should see an entry on the list labelled “Canonical Partners”. Check the box at the left of that entry, then click Close.

You will now be returned to the main Ubuntu Software Centre window, where an “In Progress” indicator will appear for a minute or so. Once complete, you can search for “JDK” and… it still won’t show it to you.

As the JDK is not something that most home users want, there’s an extra obstacle in the way – you must ask the Software Centre to show you “technical items”. There’s a link at the bottom of the window for this:

You should now have an extensive list of packages that feature the letters “JDK”. You want to pick the one with the package name sun-java6-jdk. Click it, then click the Install button on the right.

The JDK will now be downloaded and installed. Within a couple of minutes, this will be complete; the Install button will change to say Remove and the icon next to sun-java6-jre will show a green tick.

Sun’s JDK is now installed. You can now search for and install Sun’s JRE, and anything else you might want from the Partner repository. The appropriate locations have been added to the system path automatically, but if you should need to find the JDK files manually, they’re in /usr/lib/jvm/java-6-sun-1.6.0.26 (the last section of the path may change if the latest JDK version is later than it was when this article was written).