This page explains how to get Java up and running on Ubuntu.
JDK vs. JRE
Depending on whether you'll be doing Java development, or if you're just a regular user who wants to be able to run programs written in Java, you might want to install either the JRE, or the JDK.
- The Java Development Kit (JDK) — the JDK is for developers. It's needed to write Java code, to create your own programs.
- The Java Runtime Environment (JRE) — the JRE is for everyone. It's used to run programs written in Java, or Java Applets in web pages.
If you are a developer, you can install just the JDK — the JRE will already be included. (Of course, if you're a developer, you probably don't need me to explain all of this to you!)
Most people will just need the JRE.
Installing the JRE
I got these instructions from https://jdk-distros.dev.java.net/ubuntu.html.
The first part is easy. In the Add/Remove Programs application, simply install the Sun Java 5.0 Runtime option. (If this is the first time you've installed a component from the “Multiverse” component, you will be asked to enable it.)
Once the JRE has finished installing, many programs written in Java will work, including certain functionality in Open Office. But you still won't be able to use Java Applets in web pages; to do that, you need to enable the plugin. To do that, go to a command prompt, and type in:
sudo apt-get install sun-java5-plugin
If Firefox (or your other preferred browser) is already open, you'll need to close it and re-open it, for the changes to take effect.
If you're a developer, and need to install the JDK, don't bother with the Ubuntu package manager; simply go to Sun's website, at http://java.sun.com/javase/downloads/index.jsp, and get the JDK from there. This way you'll always be sure of getting the latest version — which is not guaranteed, if you use the package manager to get it. The Ubuntu repositories are not kept up to date with the latest Java code.