%general-entities; ]> $LastChangedBy$ $Date$ 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. In addition, the source code cannot be downloaded from some countries, so for users from those countries, the binary is the only option. If you plan on compiling the JDK source, you will still need to download the binary version to bootstrap the JDK build. You will need to download a total of four files to complete the source build: jdk-1_5_0_02-linux-i586.bin; jdk-1_5_0-src-jrl.zip; jdk-1_5_0-bin-jrl.zip; and jdk-1_5_0-mozilla_headers-unix.zip. Package Information Binary download: Version used (binary): Download MD5 sum (binary): &jdk-bin-md5sum; Source download: Download MD5 sum (source): &jdk-source-md5sum; 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) (Only required if building agianst ) JDK Dependencies Required (to Build JDK from Source) X ( or ), , , , , and Installation of JDK Both versions will be installed in parallel. You may choose to keep either or both. Install the precompiled JDK with the following commands: export VERSION=&jdk-bin-version; && export MV=`echo $VERSION | cut -d "_" -f 1,1` && export V=`echo ${VERSION} | sed -e "s/\./_/g"` && sed -i "s:^PATH=.*::" jdk-${V}-linux-i?86.bin && chmod -v +x jdk-${V}-linux-i?86.bin && mkdir -v -p bin && ln -v -sf /bin/true bin/more && yes | PATH=$PWD/bin:$PATH ./jdk-${V}-linux-i?86.bin && cd jdk${VERSION} Now, as the root user: install -v -d /opt/jdk/jdk-precompiled-${MV} && mv -v * /opt/jdk/jdk-precompiled-${MV} chown -v -R root:root /opt/jdk/jdk-precompiled-${MV} 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. Add the recently installed JDK to the path. export JAVA_HOME=/opt/jdk/jdk-precompiled-${MV} && export PATH=$PATH:${JAVA_HOME}/bin Unzip the sources: mkdir jdk-build && cd jdk-build && VERSION=&jdk-src-version; && V=`echo $VERSION | sed -e "s/\./_/g"` && unzip ../jdk-${V}-src-jrl.zip && unzip ../jdk-${V}-bin-jrl.zip && unzip ../jdk-${V}-mozilla_headers-unix.zip Apply all the patches downloaded above. for PATCH in ../jdk-&jdk-src-version;*.patch do patch -Np1 -i ${PATCH} done 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="blfs-&blfs-version;" && export DEV_ONLY=true && export ALT_MOZILLA_PATH=$PWD && 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. 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 environemnt (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; Restore the environment using the following commands: unset VERSION && unset MV && unset V && unset ALT_BOOTDIR && unset ALT_DEVTOOLS_PATH && unset BUILD_NUMBER && unset DEV_ONLY && unset ALT_MOZILLA_PATH && unset INSANE && unset MAKE_VERBOSE && unset ALT_CACERTS_FILE Command Explanations export ALT_BOOTDIR="$JAVA_HOME": This var sets the location of the bootstrap JDK. export ALT_MOZILLA_PATH=$PWD: This tells the build where to find the base directory of the plugin path (which contains the Mozilla headers). 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 per the recommendations in 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). Configuring JDK Configuration Information There are now two Java 2 SDK's 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: 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: 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 loacated in $JAVA_HOME/jre/plugin/i?86/ns7/. Make a symbolic link to the file in that directory from your browser plugins directory. The plugin must be a symlink for it to work. If not, the browsers just 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