Installing Sun Java on Fedora 12

By default Fedora 12 doesn’t install Sun’s Java, and it isn’t in the repository. This isn’t a mistake, in fact I think this is a good decision! Fedora is only dealing with free open source software. You can add other repositories to give you the extra non OSS software you want, for those who cannot live without certain software.

Fedora uses the OpenJDK, which I think is awesome.. but unfortunately as I am a Java developer at the moment, and it seems some of the software I work requires the Sun version of Java, at least to compile.

So I needed to install Sun JDK on my 64bit machine.. this is how I did it:

  1. Download the Sun Java JDK 64bit Linux bin installer.
  2. Run it to install.
  3. Even though I ran it as root it installed in the current folder. So move the folder to we it should be installed:
    sudo cp -a jdk1.6.0_16 /usr/lib/jvm/
  4. Use the alternatives command to tell Fedora to use the new Java binary, to do so we need to “install” the new binary as an option in alternatives:
    sudo /usr/sbin/alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_16/bin/java 20000
    Then use alternatives and make sure our new binary is selected:
    sudo /usr/sbin/alternatives --config java
  5. Use the following command to verify that Fedora is pointing to the right binary:
    java -version

That’s it, Sun’s Java should now be installed!

3 Replies to “Installing Sun Java on Fedora 12”

  1. Thanks! I just upgraded to Fedora 12 and used this to install Sun Java. I can now compile my software.

Leave a Reply

Your email address will not be published.