j2sdk-1.4.1

Introduction to j2sdk

Download location (HTTP):       http://freshmeat.net/projects/sunjdk
Download location (FTP):        
Version used (binary):          1.4.1_02
Version used (source):          1.4.1
Package size (binary):          59 MB
Package size (source):          77 MB
Estimated Disk space required:  1810 MB

The j2sdk 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. The precompiled binary is linked against gcc2 libraries. Due to the incompatibilities between gcc2 and gcc3, the precompiled java plugin causes problems when gcc3 compiled packages (for example mozilla) try to load the java plugin. The source package requires registration at the Sun developer site and accepting the Sun Community Source License. The source code cannot be downloaded from some countries, so for users from those countries, the binary may be the only option.

Even if you plan on compiling the jdk source, you will need to download the binary version to bootstrap the jdk build. Follow the above link to download both source and binary packages. When downloading the source also download the mozilla headers package available at the same location.

Download the patches for j2sdk source from http://downloads.linuxfromscratch.org/blfs-patches.

If you have difficulties in building the jdk, check out the javafromscratch hint at http://www.linuxfromscratch.org/~tushar/ for some workarounds.

For users who cannot download the j2sdk source owing to license restrictions, blackdown has a gcc3 based precompiled version. Check out http://www.blackdown.org/ for more information.

j2sdk depends on:
xfree86-4.3.0, zip-2.3, unzip-5.50, 
cpio-2.5, tcsh-6.12 and gcc-2.95.3

Installation of j2sdk

Both versions will be installed in parallel. You may choose to keep either or both.

Install the binary version of the jdk by running the following commands:

VERSION=1.4.1_02 &&
MV=`echo $VERSION | cut -d "_" -f 1,1` &&
V=`echo ${VERSION} | sed -e "s/\./_/g"` &&
T=`grep -a tail j2sdk-${V}-linux-i?86.bin | cut -f 2 -d " "` &&
tail $T j2sdk-${V}-linux-i?86.bin > install.sfx.$$ &&
chmod +x install.sfx.$$ &&
./install.sfx.$$ &&
cd j2sdk${VERSION} &&
install -d /opt/j2sdk/j2sdk-precompiled-${MV} &&
mv * /opt/j2sdk/j2sdk-precompiled-${MV}

The binary version is now installed.

If you don't want to compile the source, skip ahead to the configuration section.

Add the recently compiled JDK to the path.

export JAVA_HOME=/opt/j2sdk/j2sdk-precompiled-${MV} &&
export PATH=$PATH:${JAVA_HOME}/bin

Unzip and patch the source:

VERSION=1.4.1 &&
V=`echo $VERSION | sed -e "s/\./_/g"` &&
unzip j2sdk-${V}-src-scsl.zip &&
unzip j2sdk-${V}-mozilla_headers-unix.zip &&
patch -Np1 -i j2sdk-${VERSION}-fix-intl-files.patch &&
patch -Np1 -i j2sdk-${VERSION}-link-missing-libs.patch &&
patch -Np1 -i j2sdk-${VERSION}-remove-fixed-paths.patch &&
patch -Np1 -i j2sdk-${VERSION}-syntax-fixes.patch &&
patch -Np1 -i j2sdk-${VERSION}-use-included-motif.patch

Set some vars 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-`date +%s`" &&
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

The included motif doesn't build properly with the current glibc/xfree86. A solution is to build the motif library before compiling the j2sdk. Note that the motif build fails during the first run owing to some syntax error. The brute force and easiest solution is to rerun the make command:)

cd motif/lib/Xm &&
make || make &&
cd ../../..

Make and Install j2sdk with the following commands. There will be a lot of messages about missing files that look like errors. As long as the build doesn't stop, the messages are harmless, so ignore them.

cd control/make &&
make &&
cd ../.. &&
cd control/build/linux-i?86 &&
cp -a j2sdk-image /opt/j2sdk/j2sdk-1.4.1

Command explanations

T=`grep... : Determines the part where the tarfile begins in the self extracting archive.

patch -Np1 -i j2sdk-${VERSION}-fix-intl-files.patch : Patch to fix duplicate messages in the intl files.

patch -Np1 -i j2sdk-${VERSION}-link-missing-libs.patch : Patch to add missing libs to fix unresolved symbols.

patch -Np1 -i j2sdk-${VERSION}-remove-fixed-paths.patch : The build wants the binaries in specific locations, this patch modifies this to use the current PATH environment to find binaries.

patch -Np1 -i j2sdk-${VERSION}-syntax-fixes.patch : Patch to fix syntax for gcc3.

patch -Np1 -i j2sdk-${VERSION}-use-included-motif.patch : Patch to rename the internal motif library to avoid conflicts with an incompatible system installed version.

export ALT_BOOTDIR="$JAVA_HOME" : This var sets location of the bootstrap JDK.

export ALT_MOZILLA_PATH=$PWD : This sets the variable that points to where you unzipped the mozilla headers.

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

export BUILD_NUMBER="blfs-`date +%s`" : This will help you identify this compiled version of the runtime environment and virtual machine by appending this information to the version in the output to "java -version".

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

unset JAVA_HOME : This clears the JAVA_HOME variable and prevents misdirection during compile.

unset CLASSPATH : This clears the CLASSPATH variable and prevents misdirection during compile.

unset CFLAGS... : These flags cause miscompilation of the build. Never set these.

export INSANE=true : Unless you specify that you are insane the build will not proceed. The certified platform for the build is Redhat 6.1. The above variable ensures that all the errors related to compiling on a non-certified platform will be converted to warnings.

export MAKE_VERBOSE=true : Allows the current compilation command to be displayed on the console.

export ALT_CACERTS_FILE... : Specifies the certificate file to use.

Configuring j2sdk

Configuration Information

We have two Java 2 SDK's installed in /opt/j2sdk. Decide on which one you would like to use as the default. For example if you decide to use the source compiled j2sdk, do the following:

ln -nsf j2sdk-1.4.1 /opt/j2sdk/j2sdk

Add the following lines to your shell startup file (e.g. /etc/profile).

export JAVA_HOME=/opt/j2sdk/j2sdk
export PATH=$PATH:$JAVA_HOME/bin

Add $JAVA_HOME/man to your MANPATH variable or to /etc/man.conf

The java plugin is in the directory $JAVA_HOME/jre/plugin/i?86/ns610/. Make a symbolic link to the file in that directory from your plugins directory.

Contents

The j2sdk package contains appletviewer, extcheck, idlj, jar, jarsigner, java, javac, javadoc, javah, javap, jdb, keytool, native2ascii, orbd, policytool, rmic, rmid, rmiregistry, rmiregistry, serialver, servertool and tnameserv.

Description

appletviewer

appletviewer runs Java applets outside of the context of a browser.

extcheck

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

idlj

idlj generates Java bindings from a given IDL file.

jar

jar combines multiple files into a single JAR archive file.

jarsigner

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

java

java launches a Java application by starting a Java runtime environment, loading a specified class and invoking that class's main method.

javac

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

javadoc

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

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

javap

javap disassembles a Java class file.

jdb

jdb is a simple command-line debugger for Java classes.

keytool

keytool is a key and certificate management utility.

native2ascii

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

orbd

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

policytool

policytool creates and manages a policy file graphically.

rmic

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

rmid

rmid starts the activation system daemon.

rmiregistry

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

serialver

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

servertool

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

tnameserv

tnameserv starts the Java IDL name server.