Contents
$JAVA_HOME/lib/*, $JAVA_HOME/jre/lib/*, and
libjavaplugin_oji.so
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. You will first need to download and install the binary version of the JDK (you'll need to click and agree to the “Sun Microsystems, Inc. Binary Code License Agreement”). To build from the source, you will also need to download the additional files and patches to complete the source build as detailed below. Note that in some countries you cannot download the source code.
Binary download (jdk-1_5_0_11-linux-i586.bin): http://java.sun.com/javase/downloads/index_jdk5.jsp
Download MD5 sum: 14ba8eccfd97f6bd23d8dc32b38b1121
Download size (binary): 49 MB
Estimated disk space required: 150 MB
The source code is distributed under two licenses and most will need the JRL version. The JIUL version is listed as well, but you only need to download one or the other.
JRL Source
http://www.java.net/download/tiger/tiger_u11/jdk-1_5_0_11-fcs-src-b03-jrl-15_dec_2006.jar
e6661cce9c94009e2fa909a151c0160c
57 MB
JIUL Source
http://www.java.net/download/tiger/tiger_u11/jdk-1_5_0_11-fcs-src-b03-jiul-15_dec_2006.jar
be3653bc93d9efe715cb7a64c513eeef
57 MB
Source Binaries
http://www.java.net/download/tiger/tiger_u11/jdk-1_5_0_11-fcs-bin-b03-jrl-15_dec_2006.jar
7c952fba37101c154f1636dc401aa093
2.2 MB
Mozilla Headers
http://www.java.net/download/tiger/tiger_u11/jdk-1_5_0_11-mozilla_headers-b03-unix-15_dec_2006.jar
16ed66d11701496e3b4e10a24edd3f1b
7.4 MB
Estimated disk space required: 1.9 GB
Estimated build time: 30 SBU
http://www.linuxfromscratch.org/patches/blfs/svn/jdk-1.5.0_11-gcc4-1.patch
http://www.linuxfromscratch.org/patches/blfs/svn/jdk-1.5.0_11-motif_fixes-1.patch
http://www.linuxfromscratch.org/patches/blfs/svn/jdk-1.5.0_11-nptl-1.patch
http://www.linuxfromscratch.org/patches/blfs/svn/jdk-1.5.0_11-remove_broken_demo-1.patch
http://www.linuxfromscratch.org/patches/blfs/svn/jdk-1.5.0_11-remove_fixed_paths-1.patch
http://www.linuxfromscratch.org/patches/blfs/svn/jdk-1.5.0_11-remove_debug_image-1.patch (skips compiling of the JDK debug image)
http://www.linuxfromscratch.org/patches/blfs/svn/jdk-1.5.0_11-static_cxx-1.patch (forces dynamic linking to GCC libs)
X Window System, Zip-2.32, UnZip-5.52, cpio-2.7, ALSA Library-1.0.13, and Tcsh-6.14.00
User Notes: http://wiki.linuxfromscratch.org/blfs/wiki/jdk
The instructions below install both the binary and source versions. You may stop after installing the binary version or continue on installing the source version. You can choose to keep either or both.
The ./jdk-mod.bin
command below unpacks the distribution into a jdk1.5.0_11 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:
install -m755 jdk-1_5_0_11-linux-i?86.bin jdk-mod.bin && sed -i "s:^PATH=.*::" jdk-mod.bin && ./jdk-mod.bin && rm jdk-mod.bin
Now, as the root user:
cd jdk1.5.0_11 &&
install -v -m755 -d /opt/jdk/jdk-precompiled-1.5.0_11 &&
mv -v * /opt/jdk/jdk-precompiled-1.5.0_11 &&
chown -v -R root:root /opt/jdk/jdk-precompiled-1.5.0_11 &&
ln -v -sf motif21/libmawt.so \
/opt/jdk/jdk-precompiled-1.5.0_11/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_11 &&
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_11*.jar
do java -jar ${JAR}
done
Apply all the patches downloaded above:
for PATCH in ../jdk-1.5.0_11*.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
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 few 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.
pushd control/make && make && popd
To test the results, you can run one of the provided demo programs using the newly created java binary. Issue the following commands:
pushd control/build/linux-i?86/j2sdk-image/demo/jfc/Java2D && ../../../bin/java -jar Java2Demo.jar && popd
Now, as the root user, install the
JDK:
pushd control/build/linux-i?86 &&
cp -v -a j2sdk-image /opt/jdk/jdk-1.5.0_11 &&
chown -v -R root:root /opt/jdk/jdk-1.5.0_11 &&
ln -v -sf motif21/libmawt.so /opt/jdk/jdk-1.5.0_11/jre/lib/i386/ &&
find /opt/jdk/jdk-1.5.0_11 \
-type f -perm 600 -exec chmod -v 644 {} \; &&
find /opt/jdk/jdk-1.5.0_11 \
-name "*.so" -exec chmod -v 755 {} \; &&
chmod -v 755 /opt/jdk/jdk-1.5.0_11/jre/bin/* &&
popd
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
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_11/jre/lib/i386/: This fixes linking issues with other applications that expect to find the motif libraries with the other JDK libraries.
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_11 /opt/jdk/jdk
The information below assumes your system is set up using the instructions found in “The Bash Shell Startup Files”. You may need to extract the relevant information below and incorporate it into your system's startup files if your system is set up differently.
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.
The plugin must be a symlink for it to work. If not, the browsers will crash when you attempt to load a Java application.
$JAVA_HOME/lib/*, $JAVA_HOME/jre/lib/*, and
libjavaplugin_oji.so
Last updated on 2007-04-04 21:42:53 +0200