Linux setup steps/Install the latest SUN JDK using pinning

From Nick Jenkins

Jump to: navigation, search

Installing the latest SUN JDK using pinning:

There is a good explanation of pinning here: http://jaqque.sbih.org/kplug/apt-pinning.html

nano /etc/apt/sources.list

... and make like so:

# Testing / Lenny :
deb http://ftp.au.debian.org/debian/ lenny main contrib non-free
deb-src http://ftp.au.debian.org/debian/ lenny main
deb http://security.debian.org/ lenny/updates main contrib
deb-src http://security.debian.org/ lenny/updates main contrib

# Stable / Etch :
deb http://ftp.au.debian.org/debian/ etch main contrib non-free
deb-src http://ftp.au.debian.org/debian/ etch main
deb http://security.debian.org/ etch/updates main contrib
deb-src http://security.debian.org/ etch/updates main contrib

Then:

nano /etc/apt/preferences

... and make like so (this says "always use stable in preference to testing, but if testing is the only source of a package, then use that"). :

Package: *
Pin: release a=stable
Pin-Priority: 700

Package: *
Pin: release a=testing
Pin-Priority: 650

Update the info about what's in the repository:

aptitude update

This should not offer to upgrade anything:

aptitude upgrade

Now install Sun's JDK 6. This will come from testing, because it is not in stable.

aptitude install sun-java6-jdk sun-java6-jre

... and say "yes, accept" when prompted about the terms and conditions.

To show the available JVMs & JDKs :

update-alternatives --display java

Check current default java version with:

java -version

Change the system default from GCJ to sun's JDK:

update-java-alternatives --verbose --set java-6-sun

Check version has been updated with:

java -version

If ever need to restore to GCJ, can do so with this:update-java-alternatives --verbose --set java-gcj

Install some useful java libraries:

aptitude install libmysql-java junit junit-doc
Personal tools