Java 6 update 10 on Ubuntu 8.04

The official Ubuntu 8.04 repositories comes with a slightly outdated version of Java, namely 1.6.0 update 6. If you issue a java -version you can assert this is the case:

Unfortunately, if you are running Compiz, you are likely to then suffer the notorious gray rectangle syndrome as described in 6429775, 6434227 and 6632124 among others. The good news, the problem appears to be fixed in update 10.

Installing the latest JDK
Start by downloading the JDK for your architecture from SUN. Take the .bin file, extract it by running it as a shell script:

sh jdk-6u10-rc2-bin-b32-linux-amd64-12_sep_2008.bin

This will create a new folder called /jdk1.6.0_10. Rename this to java-6-sun- (just to remain consistent with how Debian/Ubuntu refers to JDK's) and move this folder to /usr/lib/jvm:

sudo mv jdk1.6.0_10 java-6-sun-
sudo mv jdk1.6.0_10/ /usr/lib/jvm

Officially you are suppose to use the update-java-alternatives command when using a Debian distro, but frankly I find it easier to do this manually. We need to update the /usr/lib/jvm/.java-6-sun.jinfo, so type:

gksu gedit .java-6-sun.jinfo

This will open up a hidden configuration file. The first line likely shows:


Simply change this to point to the new version:


Also, update the java 6 symlink to point to the one we just installed:

sudo rm /usr/lib/jvm/java-6-sun
sudo ln -s /usr/lib/jvm/java-6-sun- /usr/lib/jvm/java-6-sun

This should actually work for most applications, but to be sure I always like to add a few common environment variables. Do this by typing:

gksu gedit $HOME/.bashrc

Scroll down to the end of the file and add two new lines:

export JDK_HOME=/usr/lib/jvm/java-6-sun

That should do it. Issuing a java -version command now yields the latest version:

Remember the above isn't necessarily the official sanctioned way to do it, but it worked for me. Good luck to you!

It has come to my attention that Ubuntu 8.04 updates to the JVM overrides/reverts the modifications above. Keep an eye on this, I noticed it when starting seeing Compiz grey-box frames again in NetBeans.


Anonymous said…
Thanks man, that helped. But I did't get why you copy the .jinfo file but only change the name to name=java-6-sun- All the links still point to the installation ?!?!

To integrate update 10 into Ubuntus alternatives system(and also use the new browser plugin), I extended your description

Casper Bang said…
Right, I have updated the blog entry. I forgot to mention you have to update the sym link:

sudo ln -s /usr/lib/jvm/java-6-sun- java-6-sun
Honza said…

thanks for a nice quick howto.

To make "cut-and-paste" suitable, change the command
sudo mv jdk1.6.0_10/ /usr/lib/jvm
sudo mv java-6-sun- /usr/lib/jvm
Casper Bang said…
Thanks for the tip honza, I am still learning obviously ;)
Wim Deblauwe said…
What will happen if ubuntu itself updates? Will this update be overwritten or will it fail? Anybody has an idea?
Anonymous said…
Weekends to peopleig2tmean that they can have a two-day wowgold4europe good rest. For example, people gameusdcan go out to enjoy themselves or get meinwowgoldtogether with relatives and friends to talk with each storeingameother or watch interesting video tapes with the speebiewhole family.
Everyone spends agamegoldweekends in his ownmmoflyway. Within two days,some people can relax themselves by listening to music, reading novels,or watchingogeworld films. Others perhaps are more active by playing basketball,wimming ormmorpgvipdancing. Different people have different gamesavorrelaxations.
I often spend weekends withoggsalemy family or my friends. Sometimes my parents take me on a visit to their old friends. Sometimesgamersell I go to the library to study or borrow some books tommovirtexgain much knowledge. I also go to see various exhibition to broadenrpg tradermy vision. An excursion to seashore or mountain resorts is my favorite way of spending weekends. Weekends are always enjoyable for me.
igxe swagvaultoforu wowgold-usaignmax wowgoldlivebrogame thsaleGoldRockU

Popular posts from this blog

Rejsekort Scanner

@SuppressWarnings values

Installing Linux Mint on a Macbook Air