Thursday 5 August 2010

Debian: Setting Up JAVA - 'update-alternatives'

Got back to using Linux for a while now and I came up with some new stuff to put here. So this will be some kinda comeback to blogging since 2008.
This post will be adition to my last one about using update-alternatives command to setup which java VM your Debian system should use. Using this method is sometimes good enough, but for manual installation of java it won't work.
Let's say the java VM is unpacked as:

/opt/jdk1.5.0_09/


To succesfully use this version as default one the java command needs to be installed as a alternative first:

sudo update-alternatives --install /usr/bin/java java /opt/jdk1.5.0_09/bin/java 500


The last argument in the command is priority and it is mandatory. Priority is used when automatic mode for the link group is set. Any random number will do, for example '500'. Personally I don't know much about this so I won't go any further.

Last thing to do is executing one of this commands to use freshly installed java as default:

sudo update-alternatives --set java /opt/jdk1.5.0_09/bin/java
sudo update-alternatives --config java


That's all from me. Hope it helped someone.

No comments: