Replacing gcj on Fedora

Posted: October 23, 2007

Due to licensing issues, Linux distros can't distribute Sun's JDK. Instead they use gcj, which in my experience is utterly broken. I just provisioned a new Fedora 7 VPS server today, and as part of getting tomcat and ant installed I needed to replace gcj with Sun's JDK. Here's the steps:

# download Sun JDK to machine

# install RPM
rpm -Uvh jdk-1_5_0_13-linux-i586.rpm

# set JAVA_HOME and add to PATH
export JAVA_HOME=/usr/java/jdk1.5.0_13
export PATH=$JAVA_HOME/bin:$PATH

# use 'alternatives' to specify what /usr/bin/java points at
/usr/sbin/alternatives --install /usr/bin/java java /usr/java/jdk1.5.0_13/bin/java 2
/usr/sbin/alternatives --config java

# check that it worked - you should see the Sun JDK reported
/usr/bin/java -version