How to do a custom installation of Java

Back to the Unofficial Fedora FAQ


Here is how to install Sun's Java on your Fedora machine, if you can't use the Dag RPMs, for some reason, or if you want the Java Software Development Kit instead of just the normal Java Runtime Environment:

  1. Download Sun's Java Software Development Kit (which also called the "JDK"). Choose the link that starts with "Download JDK 5.0." When you get to the download page, choose the "Linux self-extracting file" version (not the RPM version).
  2. Open a Terminal.
  3. You should have the Java Software Development Kit in your home directory. It is a file whose name looks something like:

    jdk-1_5_0_03-linux-i586.bin

    To see the exact name of the file, you can do:

    ls jdk-*

  4. Become root.
  5. Change back to your home directory (instead of root's home directory):

    cd ~username

    Where "username" is your normal username.

  6. Move the JDK to the RPM Building Source directory:

    mv jdk-* /usr/src/redhat/SOURCES/

  7. Download the JPackage Java 1.5.0 Source RPM. Click on the link that looks something like "java-1.5.0-sun-1.5.0.03-1jpp.nosrc.rpm." Then, on the next page, pick where you want to download the file from. This should download the package to your home directory.

    Right now, the JPackage site seems to be having trouble, so that link doesn't work. Hopefully it will be back up soon. Until it comes back, you can download the package directly.

  8. Go back to the same root terminal you were in before. Build the Java RPM (using the file that you just downloaded):

    rpmbuild --rebuild java-1.5.0-sun*src.rpm

  9. This will create a bunch of RPMs in /usr/src/redhat/RPMS/i586/. You can install them by doing:

    yum -y install /usr/src/redhat/RPMS/i586/java-1.5.0-sun-*

Java should now be installed and working properly! You may need to log out and then log in again for some things to work properly.

(Thanks to Kai Thomsen for noting that you only have to login-logout, not reboot.)