Updating Sun JDK in Ubuntu

I recently had to update my JRE to the latest 6 update 19 to replicate a security warning dialog. I found the tutorial here. I will copy it here just in case something happens to that blog and this info that I surely will need again later disappears (Og, God forbids!)

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-6u19-linux-i586.bin

This will create a new folder called /jdk1.6.0_19. Rename this to java-6-sun-1.6.0.19 (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_19 java-6-sun-1.6.0.19
sudo mv jdk1.6.0_19/ /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:

sudo 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

If anything goes wrong after the above steps are taken, proceed to the following. But only if anything screws up. (Taken from here).

  • Open a Terminal window
  • Run sudo update-java-alternatives -l to see the current configuration and possibilities.
  • Run sudo update-java-alternatives -s XXXX to set the XXX java version as default. For Sun Java 6 this would be sudo update-java-alternatives -s java-6-sun
  • Run java -version to ensure that the correct version is being called.
You can also use the following command to interactively make the change;
  • Open a Terminal window
  • Run sudo update-alternatives --config java
  • Follow the onscreen prompt

0 komentar:

Posting Komentar