Althought it is a commercial distribution, Redhat Enterprise Linux is only supplied with software that is considered to be free; that is, openly redistributable, with licences that meet the Open Source Institute's guidelines for being considered to be open source software.
Sun's Java Development Kit does not meet this guidelines; while the JDK is available for free download, its source is not available and there are restrictions on its use. Hence, for this reason, Sun's JDK is not supplied with Redhat Enterprise Linux.
This article provides a guide to building RPMs from Sun's JDK, so that they will work correctly with your system. The following instructions will also apply to anyone running Fedora.
Details
First, run the following script to set up your home directory for compiling SRPMS:
#!/bin/sh
echo "%_topdir ${HOME}/rpm" > ${HOME}/.rpmmacros
mkdir ${HOME}/rpm || exit 1
cd ${HOME}/rpm || exit 1
mkdir BUILD RPMS SOURCES SPECS SRPMS || exit 1
if [ `arch` == 'x86_64' ]; then
cd ${HOME}/rpm/RPMS || exit 1
mkdir ia32e noarch x86_64 || exit 1
else
cd ${HOME}/rpm/RPMS || exit 1
mkdir athlon i386 i486 i586 i686 noarch || exit 1
fi
Now, download the Java nosrc SRPM from http://www.jpackage.org/. At the time of writing, the latest package was
here.
Install this file into your rpm source tree - as an unprivileged user, not as root:
rpm -i java-1.5.0-sun-1.5.0.06-1jpp.nosrc.rpm
Download the J2SE (JDK) package from Sun; the Linux self-extracting file is required for building this package, not the rpm. At the time of writing, this file was named jdk-1_5_0_06-linux-i586.bin; for the AMD64 architecture, it is jdk-1_5_0_06-linux-amd64.bin.
Move this file into the rpm/SOURCES directory:
mv jdk-1_5_0_06-linux-i586.bin ${HOME}/rpm/SOURCES
Now, build the package:
cd ${HOME}/rpm/SPECS
rpmbuild -ba java-1.5.0-sun.spec
Under x86 architectures, this will produce the following packages:
java-1.5.0-sun-1.5.0.06-1jpp.i586.rpm
java-1.5.0-sun-devel-1.5.0.06-1jpp.i586.rpm
java-1.5.0-sun-src-1.5.0.06-1jpp.i586.rpm
java-1.5.0-sun-demo-1.5.0.06-1jpp.i586.rpm
java-1.5.0-sun-plugin-1.5.0.06-1jpp.i586.rpm
java-1.5.0-sun-fonts-1.5.0.06-1jpp.i586.rpm
java-1.5.0-sun-alsa-1.5.0.06-1jpp.i586.rpm
java-1.5.0-sun-jdbc-1.5.0.06-1jpp.i586.rpm
For AMD 64, the packages built will be:
java-1.5.0-sun-1.5.0.06-1jpp.x86_64.rpm
java-1.5.0-sun-devel-1.5.0.06-1jpp.x86_64.rpm
java-1.5.0-sun-src-1.5.0.06-1jpp.x86_64.rpm
java-1.5.0-sun-demo-1.5.0.06-1jpp.x86_64.rpm
java-1.5.0-sun-fonts-1.5.0.06-1jpp.x86_64.rpm
java-1.5.0-sun-alsa-1.5.0.06-1jpp.x86_64.rpm
java-1.5.0-sun-jdbc-1.5.0.06-1jpp.x86_64.rpm
These packages can now be installed on the system using the rpm command. To build java software, you will need both the java-1.5.0-sun and java-1.5.0-sun-devel packages.
If you found this article helpful, consider making a donation to offset the costs of running this server, to one of these addresses:
Dogecoin: DBu2vJEKBE8QzZgp7nuSHXhAeyUn9vXpCS
Bitcoin: 16oaJfmt8ARXibVuKBmAtU833BLDVoPY7r
Litecoin: LerLMqzbtXyjMG2vKt8Hg6Wq1RjSmC9MZj