%general-entities; ]> $LastChangedBy$ $Date$ NONE jdk JDK-&jdk-src-version; JDK 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: (to download jdk-&jdk-bin-string;-linux-i586.bin) Download MD5 sum (binary): &jdk-bin-md5sum; Source download: (to download jdk-&jdk-src-string;-fcs-src-b05-jrl-13_oct_2005.jar (or optionally the JIUL version), jdk-&jdk-src-string;-fcs-bin-b05-13_oct_2005.jar, and jdk-&jdk-src-string;-mozilla_headers-b05-unix-26_aug_2005.jar) Download MD5 sums (source): 215c5175e54c2facccc2c7845e339725 jdk-&jdk-src-string;-fcs-bin-b05-13_oct_2005.jar 884dd87faa082d294f725857c895b6f6 jdk-&jdk-src-string;-fcs-src-b05-jrl-13_oct_2005.jar 3a3627ab55c6a63cddc90d5b3fad4b83 jdk-&jdk-src-string;-mozilla_headers-b05-unix-26_aug_2005.jar Download size (binary): &jdk-bin-size; Download size (source): &jdk-src-size; Estimated disk space required: &jdk-src-buildsize; Estimated build time: &jdk-time; Additional Downloads Required Patches Recommended Patches (skips compiling of the JDK debug image) (forces dynamic linking to GCC libs) JDK Dependencies Required (to Build JDK from Source) X (, , or ), , , , , and Installation of JDK Both the binary and source built versions will be installed. You may choose to keep either or both. The ./jdk-&jdk-bin-string;-linux-i?86.bin command below unpacks the distribution into a jdk&jdk-bin-version; 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 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-&jdk-bin-string;-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 jdk&jdk-bin-version; && install -v -d /opt/jdk/jdk-precompiled-&jdk-bin-version; && mv -v * /opt/jdk/jdk-precompiled-&jdk-bin-version; && chown -v -R root:root /opt/jdk/jdk-precompiled-&jdk-bin-version; && ln -v -sf motif21/libmawt.so \ /opt/jdk/jdk-precompiled-&jdk-bin-version;/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-&jdk-bin-version; && export PATH_HOLD=${PATH} && export PATH=${PATH}:${JAVA_HOME}/bin The source code is contained in a self-extracting jar file. 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-&jdk-src-string;*.jar do java -jar ${JAR} done Apply all the patches downloaded above: for PATCH in ../jdk-&jdk-src-version;*.patch do patch -Np1 -i ${PATCH} done If your X Window System is installed in any prefix other than /usr/X11R6, adjust as necessary and execute the following command: find . -type f -exec sed -i 's@/usr/X11R6@[/usr]@g' {} \; Set/unset some variables which affect the build: export ALT_BOOTDIR="$JAVA_HOME" && unset JAVA_HOME && unset CLASSPATH unset CFLAGS unset CXXFLAGS unset LDFLAGS export ALT_DEVTOOLS_PATH="/usr/bin" && export BUILD_NUMBER="update-05" && 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 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 Now, as the root user, install the JDK: cp -v -a j2sdk-image /opt/jdk/jdk-&jdk-src-version; && chown -v -R root:root /opt/jdk/jdk-&jdk-src-version; && ln -sf motif21/libmawt.so /opt/jdk/jdk-&jdk-src-version;/jre/lib/i386/ Restore the unprivileged user's environment using the following commands: unset ALT_BOOTDIR && unset ALT_DEVTOOLS_PATH && unset BUILD_NUMBER && unset DEV_ONLY && unset ALT_MOZILLA_HEADERS_PATH && unset INSANE && unset MAKE_VERBOSE && unset ALT_CACERTS_FILE && export PATH=${PATH_HOLD} && unset 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="blfs-&blfs-version;": 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: This clears the JAVA_HOME variable as recommended by the build instructions. unset CLASSPATH: This clears the CLASSPATH variable as recommended by the build instructions. unset CFLAGS/CXXFLAGS...: 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-&jdk-src-version;/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-&jdk-src-version; /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 export JAVA_HOME # Adjust PATH pathappend ${JAVA_HOME}/bin PATH # Auto Java Classpath Updating # Create symlinks to this directory for auto classpath setting AUTO_CLASSPATH_DIR=/usr/lib/classpath if [ -z ${CLASSPATH} ]; then CLASSPATH=.:${AUTO_CLASSPATH_DIR} else CLASSPATH="${CLASSPATH}:.:${AUTO_CLASSPATH_DIR}" fi # Check for empty AUTO_CLASSPATH_DIR ls ${AUTO_CLASSPATH_DIR}/*.jar &> /dev/null && for i in ${AUTO_CLASSPATH_DIR}/*.jar do CLASSPATH=${CLASSPATH}:"${i}" done export CLASSPATH # 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. Contents Installed Programs Installed Libraries Installed Directory appletviewer, extcheck, idlj, jar, jarsigner, java, javac, javadoc,javah, javap, javaws, jdb, keytool, native2ascii, orbd, policytool, rmic, rmid, rmiregistry, serialver, servertool, and tnameserv $JAVA_HOME/lib/*, $JAVA_HOME/jre/lib/*, and libjavaplugin_oji.so /opt/jdk Short Descriptions appletviewer runs Java applets outside of the context of a browser. appletviewer extcheck checks a specified JAR file for title and version conflicts with any extensions installed in the JDK software. extcheck idlj generates Java bindings from a given IDL file. idlj jar combines multiple files into a single JAR archive file. jar jarsigner signs JAR (Java ARchive) files and verifies the signatures and integrity of a signed JAR. jarsigner java launches a Java application by starting a Java runtime environment, loading a specified class and invoking its main method. java javac reads class and interface definitions, written in the Java programming language, and compiles them into bytecode class files. javac 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. javadoc javah generates C header and source files that are needed to implement native methods. javah javap disassembles a Java class file. javap javaws launches Java application/applets hosted on a network. javaws jdb is a simple command-line debugger for Java classes. jdb keytool is a key and certificate management utility. keytool native2ascii converts files that contain non-supported character encoding into files containing Latin-1 or Unicode-encoded characters. native2ascii orbd is used to enable clients to transparently locate and invoke persistent objects on servers in the CORBA environment. orbd policytool creates and manages a policy file graphically. policytool rmic generates stub and skeleton class files for remote objects from the names of compiled Java classes that contain remote object implementations. rmic rmid starts the activation system daemon. rmid rmiregistry creates and starts a remote object registry on the specified port on the current host. rmiregistry serialver returns the serialVersionUID for one or more classes in a form suitable for copying into an evolving class. serialver servertool provides an ease-of-use interface for application programmers to register, unregister, startup and shutdown a server. servertool tnameserv starts the Java IDL name server. tnameserv