Here’s the command to install an alternative installation of Java:
alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_04/bin/java 99
In this case I used the self extracting file (not the RPM) from Sun, and moved the directory to /usr/lib/jvm/jdk1.6.0_04.
Update:
To finish it off, you need to do this:
alternatives --config java There are 2 programs which provide 'java'. Selection Command ----------------------------------------------- *+ 1 /usr/lib/jvm/jre-1.4.2-gcj/bin/java 2 /usr/lib/jvm/jdk1.6.0_04/bin/java Enter to keep the current selection[+], or type selection number: 2 [root@localhost jvm]# java -version java version "1.6.0_04" Java(TM) SE Runtime Environment (build 1.6.0_04-b12) Java HotSpot(TM) Client VM (build 10.0-b19, mixed mode, sharing)
Sometimes SELinux will prevent something from launching (e.g. Eclipse), and you’ll have to run a command like:
chcon -t textrel_shlib_t /usr/lib/jvm/jdk1.6.0_04/jre/lib/i386/clientlibjvm.so
Thanks! This tip made short work of my 1st attempt at getting update-alternatives working.
THANK YOU! I spent ages trying to find a simple-to-follow method to set an alternative JRE. Wish I’d come across this post earlier. Many thanks!
I hate linux. It is made for fuckwits by fuckwits
Oh yeah, because Windows is soooooo much better…
chcon -t is temporary untill next reboot.
you will want to use
semanage fcontext -a -t textrel_shlib_t “/usr/lib/jvm/jdk1.6.0_04/jre/lib/i386/clientlibjvm.so”
Many Thanks