Installing the Sun J2SE JRE (Java Runtime Environment) on Ubuntu Breezy

PaulStimpson's picture

Installing the Sun J2SE JRE (Java Runtime Environment) on Ubuntu Breezy

Started by PaulStimpson. Being able to view Java content in a browser is pretty important for many websites. Ubuntu Breezy installs with the Firefox browser as standard but without the Sun JRE. I had previously converted the RPM package of the JRE to a DEB with alien -d but this doesn't seem to work with Breezy and the current JRE (1.5.0 Update 6.) If I use the alien method Java applets don't run and if Firefox was launched from a terminal the error "java/lang/NoClassDefFoundError: java/lang/Object" is displayed with a message saying that the VM didn't start up properly. The following installation method works.

Before you begin

Create a directory to hold the files then visit the Sun JRE download page Download the file marked Linux (self-extracting file) and save it in the directory you just created.

The How-To Bit...

  • Close all your Firefox windows.
  • Open a terminal Applications > Accessories > Terminal.
  • Use the cd command to enter the directory contining the file you downloaded.
  • Type the following commands:

sudo apt-get install fakeroot java-package java-common


(This installs fakeroot, java-package and java-common - You only need to do this the first time you perform this procedure)

fakeroot make-jpkg jre-1_5_0_06-linux-i586.bin


(This makes the new Debian package from the Sun download. You will need to read the licence and type "yes" to complete the process. It takes a while.)

sudo dpkg -i sun-j2re1.5_1.5.0+update06_i386.deb


(Install your newly-created package.)

sudo update-alternatives --config java


(This selects which of the Java alternatives you want to provide Java on your machine. Choose the one with "sun" in the name. For me it was option 3.)

java -version


(If everything has worked right you will see the version of the JRE displayed and it will be the same as the one you just installed - java version "1.5.0_06"

If you open Firefox again and type about:plugins in the address bar you should find the correct version of Java in the list of installed plugins. All done.

Useful Links