Returning to - Re: [CentOS] Installing Java 1.4.2

Mon Feb 20 09:13:07 UTC 2006
Will McDonald <wmcdonald at>

I had to install the 1.4.2 SDK from Jpackage a while back for some
friend's servers and vaguely documented it as I went. Here's the
relevant bits with the profanities removed :) We'd already rsynced
down the Jpackage repo so where I reference file:// for the baseurl
you'll want to use http/ftp.

Using Jpackage allows us to manage the installation of Java packages
on RPM systems in a consistent fashion. Some packages will still
require downloading of their sources due to licensing restictions but
this source is used, in conjunction with Jpackage supplied SPEC files
to build RPMs.

First we need to create a build environment as a normal, non-root
user. In this user's home area create the build tree as follows...

 |-- BUILD
 |-- RPMS
 |   |-- i386
 |   |-- i586
 |   `-- noarch
 |-- SPECS
 |-- SRPMS
 `-- tmp

This command will create the build tree shown above...

 $ mkdir -p rpm/{BUILD,RPMS/{i386,i586,noarch},SOURCES,SPECS,SRPMS,tmp}

Create an ~/.rpmmacros file, this will allow you to install SRPMs
locally without b0rking the rest of the system, and add the following
to it, changing the %packager details to your own...

 %_topdir        %(echo ${HOME}/rpm)
 %_tmppath       %{_topdir}/tmp
 %packager       Firstname Lastname < your.address at here>

As the repository files have already been rsync-ed down from the
mirrors onto yumserv1/dev-rhe-a1 now we can setup Setup a Yum
repository definition for the Jpackage repository. In
/etc/yum.repos.d/ create a jpackge.repo and add the following...

 # Be sure to enable the distro specific repository for your distro below:
 # - jpackage-fc for Fedora Core
 # - jpackage-rhel for Red Hat Enterprise Linux and derivatives

 name=JPackage (free), generic

 name=JPackage (free) for Red Hat Enterprise Linux $releasever

 name=JPackage (non-free), generic
 baseurl= ftp://yumserv1/jpackage/1.6/generic/non-free/

The firewalls on both yumserv1/dev-rhe-a1 and on webserv1 have been
modified to allow limited FTP for the purposes of Yum updates.

As root install the rpm-build and the Jpackage utils packages...

 # yum -y install rpm-build
 # yum -y install jpackage-utils


Grab java-1.4.2-sun- from your Yum repository
and install it as your non-root user...

 $ cd ~/rpm/SRPMS
 $ wget ftp://yumserv1/jpackage/1.6/generic/non-free/SRPMS/java-1.4.2-sun-
 $ rpm -ivh ~/rpm/SRPMS/java-1.4.2-sun-

Get the Java 1.4.2 SDK from, specifically...

This has to be done via a browser because of Sun's click-through
annoyance licensing. Download Linux Platform - Java(TM) 2 SDK,
Standard Edition 1.4.2_10 self-extracting file
j2sdk-1_4_2_10-linux-i586.bin .

Copy this file into ~/rpm/SOURCES and then rpmbuild the RPM from the
SPEC file which was installed when we installed
 rpmbuild -ba ~/rpm/SPECS/java-1.4.2-sun.spec

This will compile RPMs from the Java SDK and place them in
~/rpm/RPMS/i586. From these RPMs we want to install java-1.4.2-sun,
java-1.4.2-sun-devel and an OS dependancy xorg-x11-deprecated-libs. As
root carry out the following replacing $BUILDUSER with the non-root
username we've been using for the builds...

 # yum -y install

Yum will take care of the xorg-x11 dependecy for you.