Monday, April 22, 2013

Set Sun's JDK as Default on Fedora 18

If you installed Sun's JDK (yes, I still call it Sun's!) from the binary package (versus the RPM) and need to use it as the default implementation, you can manually alter the PATH and JAVA_HOME but the easy way is to, at first let Fedora know about it:

# java
> alternatives --install /usr/bin/java java /opt/java/jdk1.7.0_21/jre/bin/java 20000

# javaws
> alternatives --install /usr/bin/javaws javaws /opt/java/jdk1.7.0_21/jre/bin/javaws 20000

# Java Browser (Mozilla) Plugin 64-bit
> alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /opt/java/jdk1.7.0_21/jre/lib/amd64/libnpjp2.so 20000

# Install javac only if you installed JDK (Java Development Kit) package
> alternatives --install /usr/bin/javac javac /opt/java/jdk1.7.0_21/bin/javac 20000
> alternatives --install /usr/bin/jar jar /opt/java/jdk1.7.0_21/bin/jar 20000


and then set it as the default:

> alternatives --config java
> alternatives --config javac

Source.

No comments: