The quickest way to install Sun’s JDK on a Red Hat machine

Scott StultsFebruary 25, 2008

For various reasons I inevitably need to install Sun’s JDK on a Red Hat-based machine. If you’ve done this, you know that Java’s related files are managed by the **alternatives **system. I used to simply ignore that fact and rewrite the links manually; a PITA to say the least, but it saved me from Reading The Fine Manpage on **alternatives **and numerous attempts at getting the commands right.

After a bit of Googling I ran across this great reference which describes what should be the definitive guide. For the impatient, I’ll summarize the exact steps here:

rpm --import
cd /etc/yum.repos.d/
yum --enablerepo=jpackage-generic-nonfree install java-1.6.0-sun-compat.i586

[addendum on 03/05/08]

Actually, that last line will only work on a Fedora box. If you’re using something like RHEL4 you’ll need to install Java from Sun’s site, then yum, then you can yum the compat package:

rpm -ivh
rpm -ivh
rpm -ivh
rpm -ivh
rpm -ivh

More blog articles:

Let's do a project together!

We provide tailored search, discovery and personalization solutions using Solr and Elasticsearch. Learn more about our service offerings