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.