Friday, September 26, 2008

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-1.6.0.10 (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-1.6.0.10
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:


name=java-6-sun-1.6.0.06
...

Simply change this to point to the new version:


name=java-6-sun-1.6.0.10
...


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-1.6.0.10/ /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
export JAVA_HOME=$JDK_HOME


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!

Update:
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.


7 comments:

Thasso 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-1.6.0.10. All the links still point to the 1.6.0.06 installation ?!?!

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

http://java.randgestalten.de/?p=31

cheers

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-1.6.0.10/ java-6-sun

Honza said...

Hi,

thanks for a nice quick howto.

To make "cut-and-paste" suitable, change the command
sudo mv jdk1.6.0_10/ /usr/lib/jvm
to
sudo mv java-6-sun-1.6.0.10/ /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

Anonymous said...

Today,we are proud to announce the launch of the new wedding support service sell ffxi gil,packed with features sure to sell ffxi gils delight adventurers across Vana'diel looking to exchange eternal vows with their beloved!Responding to player demands for greater customization,the new service will grant brides and grooms freedom in choosing location,timing,dialogue,and sell Final Fantasy XI Gil more for their ceremony,allowing them to create a truly memorable event all their own.Information on all the features,including in-game sell ffxi gil item vendors and wedding certificates,can be found on the new wedding support site,so head on over sell ffxi gils and get started planning the wedding of your dreams sell Final Fantasy XIGil!