JDK-1.5.0_10

Introduction to JDK

The JDK package contains Sun's Java development environment. This is useful for developing Java programs and provides the runtime environment necessary to run Java programs. It also includes a plug-in for browsers so that they can be Java aware.

The JDK comes in two flavors, a precompiled binary and a source package. Previously, the plugin included in the JDK binary package was unusable on LFS owing to incompatibilities with GCC-3 compiled browsers. This is not the case anymore.

In order to use the source code and patches, you must read and agree to the Sun Java Research License or optionally, the Sun Java Internal Use License. In addition, the source code is not allowed to be downloaded to some countries, so for users in those countries, the binary is the only option.

You will first need to download and install the binary version of the JDK.

To build from the source, you will also need to download the additional files and patches to complete the source build as detailed below.

Package Information

  • Binary download: http://java.sun.com/j2se/1.5.0/download.jsp (to download jdk-1_5_0_10-linux-i586.bin)

  • Download MD5 sum (binary): d916c24bed9eef7aebc2626115e14a11

  • Source download: http://download.java.net/tiger/archive/tiger_u10/ (to download jdk-1_5_0_10-fcs-src-b03-jrl-09_nov_2006.jar (or optionally the JIUL version), jdk-1_5_0_10-fcs-bin-b03-09_nov_2006.jar, and jdk-1_5_0_10-mozilla_headers-b03-unix-09_nov_2006.jar)

  • Download MD5 sums (source):

    09842a4e68040db473e04dbcc284f1d5 jdk-1_5_0_10-fcs-bin-b03-09_nov_2006.jar
    b59335f620e7da524be168b07319fa3b jdk-1_5_0_10-fcs-src-b03-jrl-09_nov_2006.jar
    f49df1a1e7fe351b7fa9f66db121616e jdk-1_5_0_10-mozilla_headers-b03-unix-09_nov_2006.jar
  • Download size (binary): 47.2 MB

  • Download size (source): 64.2 MB (three .jar files)

  • Estimated disk space required: 1882 MB

  • Estimated build time: 34 SBU

Additional Downloads

Required Patches

Recommended Patches

JDK Dependencies

Required (to Build JDK from Source)

X Window System, Zip-2.32, UnZip-5.52, cpio-2.6, ALSA Library-1.0.13, and Tcsh-6.14.00

User Notes: http://wiki.linuxfromscratch.org/blfs/wiki/jdk

Installation of JDK

Both the binary and source built versions will be installed. You may choose to keep either or both.

[Tip]

Tip

The ./jdk-mod.bin command below unpacks the distribution into a jdk1.5.0_10 directory. You will be required to view, and then accept (by entering a y keypress), a license agreement before any files are unpacked. If you are scripting (automating) the build, you'll need to account for this. There is information about automating build commands in the Automated Building Procedures section of Chapter 2. Towards the end of this section, specific information for automating this type of installation is discussed.

Normally in BLFS, the files are unpacked into a subdirectory and the starting point for the installation procedures is that location. For this application only, start in the directory where all the downloaded files are located.

Install the precompiled JDK with the following commands:

cp jdk-1_5_0_10-linux-i?86.bin jdk-mod.bin &&
sed -i "s:^PATH=.*::" jdk-mod.bin &&
chmod -v +x jdk-mod.bin &&
./jdk-mod.bin

Now, as the root user:

cd jdk1.5.0_10 &&
install -v -d /opt/jdk/jdk-precompiled-1.5.0_10 &&
mv -v * /opt/jdk/jdk-precompiled-1.5.0_10 &&
chown -v -R root:root /opt/jdk/jdk-precompiled-1.5.0_10 &&
ln -v -sf motif21/libmawt.so \
    /opt/jdk/jdk-precompiled-1.5.0_10/jre/lib/i386/ &&
cd ..

The binary version is now installed.

If you don't want to compile the source or are not in a position to download the source owing to license restrictions, skip ahead to the configuration section.

Save the existing path, and append the recently installed JDK.

export JAVA_HOME=/opt/jdk/jdk-precompiled-1.5.0_10 &&
export PATH_HOLD=${PATH} &&
export PATH=${PATH}:${JAVA_HOME}/bin

The source code is contained in self-extracting jar files. You will need to be in a windowed environment to extract the sources. Create a directory to store the extracted sources. Choose the newly created jdk-build directory when prompted for the target directory.

mkdir jdk-build &&
cd jdk-build &&
for JAR in ../jdk-1_5_0_10*.jar
    do java -jar ${JAR}
done

Apply all the patches downloaded above:

for PATCH in ../jdk-1.5.0_10*.patch
    do patch -Np1 -i ${PATCH}
done

If your X Window System is installed into any prefix other than /usr/X11R6, execute the following command, replacing <PREFIX> with the installation prefix of the X Window System:

find . -type f -exec sed -i 's@/usr/X11R6@<PREFIX>@g' {} \;

Set/unset some variables which affect the build:

export ALT_BOOTDIR=${JAVA_HOME} &&
export CLASSPATH_HOLD=${CLASSPATH} &&
unset JAVA_HOME CLASSPATH CFLAGS CXXFLAGS LDFLAGS &&
export ALT_DEVTOOLS_PATH="/usr/bin" &&
export BUILD_NUMBER="update-10" &&
export DEV_ONLY=true &&
export ALT_MOZILLA_HEADERS_PATH=${PWD}/share/plugin/ &&
export INSANE=true &&
export MAKE_VERBOSE=true &&
export ALT_CACERTS_FILE=${ALT_BOOTDIR}/jre/lib/security/cacerts
[Warning]

Warning

Setting CFLAGS/CXXFLAGS/LDFLAGS is guaranteed to make the build fail. If you are interested in optimizing the build, set OTHER_CFLAGS/OTHER_CXXFLAGS/OTHER_LDFLAGS instead. -O3, even in OTHER_C{,XX}FLAGS, is known to cause a build failure.

Additionally, if you would like to make in parallel, add the following:

export HOTSPOT_BUILD_JOBS=<3>

Build the JDK with the following commands. There will be a lot of messages about missing files that look like errors. These are caused by not meeting the expected build environment (Red Hat). As long as the build doesn't stop, the messages are harmless.

cd control/make &&
make &&
cd ../build/linux-i?86

To test the results, you can run one of the provided demo programs using the newly created java binary. Issue the following commands:

cd j2sdk-image/demo/jfc/Java2D &&
../../../bin/java -jar Java2Demo.jar &&
cd ../../../..

Now, as the root user, install the JDK:

cp -v -a j2sdk-image /opt/jdk/jdk-1.5.0_10 &&
chown -v -R root:root /opt/jdk/jdk-1.5.0_10 &&
ln -v -sf motif21/libmawt.so  /opt/jdk/jdk-1.5.0_10/jre/lib/i386/

Restore the unprivileged user's environment using the following commands:

export JAVA_HOME=${ALT_BOOTDIR} &&
export CLASSPATH=${CLASSPATH_HOLD} &&
export PATH=${PATH_HOLD} &&
unset ALT_BOOTDIR CLASSPATH_HOLD ALT_DEVTOOLS_PATH BUILD_NUMBER &&
unset DEV_ONLY ALT_MOZILLA_HEADERS_PATH INSANE MAKE_VERBOSE &&
unset ALT_CACERTS_FILE PATH_HOLD

Command Explanations

export ALT_BOOTDIR=${JAVA_HOME}: This variable sets the location of the bootstrap JDK.

export ALT_MOZILLA_HEADERS_PATH=${PWD}/share/plugin/: This tells the build exactly where to find the Mozilla headers. This has changed since the previous version and is not mentioned in the installation documentation included with the package source.

export ALT_DEVTOOLS_PATH="/usr/bin": This changes the location where the build finds the needed executables.

export BUILD_NUMBER="update-10": This will help you identify the compiled version of the runtime environment and virtual machine by appending this information to the version string.

export DEV_ONLY=true: This command skips compiling the documentation and eliminates a dependency on rpm.

unset JAVA_HOME CLASSPATH CFLAGS CXXFLAGS LDFLAGS: These variables cause miscompilation of the build. Never set them.

export INSANE=true: The certified platform for the build is Redhat Enterprise Advanced Server 2.1. This variable ensures that all the errors related to compiling on a non-certified platform will be displayed as warnings instead of errors.

export MAKE_VERBOSE=true: Allows the compiler commands to be displayed on the console.

export ALT_CACERTS_FILE...: Specifies the certificate file to use (from the installed binary JDK).

ln -sf motif21/libmawt.so /opt/jdk/jdk-1.5.0_10/jre/lib/i386/: This fixes linking issues with other applications that expect to find the motif libraries with the other JDK libraries.

Configuring JDK

Configuration Information

There are now two Java 2 SDKs installed in /opt/jdk. You should decide on which one you would like to use as the default. For example if you decide to use the source compiled JDK, do the following as the root user:

ln -v -nsf jdk-1.5.0_10 /opt/jdk/jdk

Add the following jdk.sh shell startup file to the /etc/profile.d directory with the following commands as the root user:

cat > /etc/profile.d/jdk.sh << "EOF"
# Begin /etc/profile.d/jdk.sh

# Set JAVA_HOME directory
JAVA_HOME=/opt/jdk/jdk

# Adjust PATH
pathappend ${JAVA_HOME}/bin PATH

# Auto Java CLASSPATH
# Copy jar files to, or create symlinks in this directory
AUTO_CLASSPATH_DIR=/usr/lib/classpath
pathprepend . CLASSPATH
for dir in `find ${AUTO_CLASSPATH_DIR} -type d 2>/dev/null`; do
    pathappend $dir CLASSPATH
done

export JAVA_HOME CLASSPATH
unset AUTO_CLASSPATH_DIR
unset dir

# End /etc/profile.d/jdk.sh
EOF

The Java plugin is located in $JAVA_HOME/jre/plugin/i?86/ns7/. Make a symbolic link to the file in that directory from your browser(s) plugins directory.

[Important]

Important

The plugin must be a symlink for it to work. If not, the browsers will crash when you attempt to load a Java application.

Contents

Installed Programs: appletviewer, extcheck, idlj, jar, jarsigner, java, javac, javadoc,javah, javap, javaws, jdb, keytool, native2ascii, orbd, policytool, rmic, rmid, rmiregistry, serialver, servertool, and tnameserv
Installed Libraries: $JAVA_HOME/lib/*, $JAVA_HOME/jre/lib/*, and libjavaplugin_oji.so
Installed Directory: /opt/jdk

Short Descriptions

appletviewer

runs Java applets outside of the context of a browser.

extcheck

checks a specified JAR file for title and version conflicts with any extensions installed in the JDK software.

idlj

generates Java bindings from a given IDL file.

jar

combines multiple files into a single JAR archive file.

jarsigner

signs JAR (Java ARchive) files and verifies the signatures and integrity of a signed JAR.

java

launches a Java application by starting a Java runtime environment, loading a specified class and invoking its main method.

javac

reads class and interface definitions, written in the Java programming language, and compiles them into bytecode class files.

javadoc

parses the declarations and documentation comments in a set of Java source files and produces a corresponding set of HTML pages describing the classes, interfaces, constructors, methods, and fields.

javah

generates C header and source files that are needed to implement native methods.

javap

disassembles a Java class file.

javaws

launches Java application/applets hosted on a network.

jdb

is a simple command-line debugger for Java classes.

keytool

is a key and certificate management utility.

native2ascii

converts files that contain non-supported character encoding into files containing Latin-1 or Unicode-encoded characters.

orbd

is used to enable clients to transparently locate and invoke persistent objects on servers in the CORBA environment.

policytool

creates and manages a policy file graphically.

rmic

generates stub and skeleton class files for remote objects from the names of compiled Java classes that contain remote object implementations.

rmid

starts the activation system daemon.

rmiregistry

creates and starts a remote object registry on the specified port on the current host.

serialver

returns the serialVersionUID for one or more classes in a form suitable for copying into an evolving class.

servertool

provides an ease-of-use interface for application programmers to register, unregister, startup and shutdown a server.

tnameserv

starts the Java IDL name server.

Last updated on 2007-02-06 23:51:27 -0600