Download location (HTTP): http://freshmeat.net/projects/sunjdk Download location (FTP): Version used: 1.4.0_01 Package size: 39.8 MB Estimated Disk space required: 82 MB |
The j2sdk package contains Sun's java development environment - precompiled. This is needed to fulfull the circular dependency when we compile java.
Before installing j2sdk, you need to download libstdc++-libc6.1-1.so.2.bz2 from ftp://ftp.linuxfromscratch.org/blfs-patches/cvs and decompress it to your source directory.
Install j2sdk by running the following commands:
mkdir java && mv j2sdk*.bin java && cd java && chmod 711 j2sdk*.bin && ./j2sdk*.bin && mv j2sdk*.bin .. && cp ../libstdc++-libc6.1-1.so.2 j2sdk1.4.0_01/jre/lib/i386 |
Test the installation with the following commands:
export JAVA_HOME=$PWD/j2sdk1.4.0_01 && j2sdk1.4.0_01/jre/bin/java -version |
If you get a version line, a description of the runtime environment and a desrciption of the client VM (virtual machine), you are ready to go.
If you are not going to compile java from scratch, move the java tree to /opt:
mv j2sdk1.4.0_01 /opt/java |
chmod 711 j2sdk*.bin : Makes the downloaded bin file executible.
cp ../libstdc++-libc6.1-1.so.2 j2sdk1.4.0_01/jre/lib/i386 : Puts the linked gcc2 library where java can find it.
/etc/profile, ~/.bash_profile, ~/.profile, ~/.bashrc
Add the following lines to the appropriate file listed above.
export JAVA_HOME=<path to>/j2sdk1.4.0_01 export PATH=$PATH:$JAVA_HOME/bin |
You now have a java development environment installed on your machine, however it is compiled with a different library than the other programs which creates incompatabilities. Specifically, the plug-in will not work with browsers compiled on your machine.
There is a solution if you are willing to accept the SUN COMMUNITY SOURCE LICENSE for the Java 2 Platform Standard Edition. Note that you are not allowed to distribute the resulting JDK/JRE and you also cannot use the resulting JDK to compile programs for distribution unless they pass Sun's compatiblity tests. In short don't use the resulting JDK except for your personal use.
Download location (HTTP): http://wwws.sun.com/software/java2/download.html Download location (FTP): Version used: 1.4.0 Package size: 52.2 MB Estimated Disk space required: 1186 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.
j2sdk depends on: xfree86-4.2.1, zip-2.3, unzip-5.50, cpio-2.5, tcsh-6.12 and j2sdk-1.4.0_01 |
To install j2sdk, you need to download the following files into your source directory:
From the download location (registration required) j2sdk-1.4.0-src-scsl.zip j2sdk-1.4.0-motif-linux-i386.zip j2sdk-1.4.0-mozilla_headers-unix.zip From ftp://ftp.linuxfromscratch.org/blfs-patches/cvs j2sdk-gcc31.patch |
You should be in the java directory under your source directory. Verifiy that environment is set as described in the configuration section of the binary installation. If not:
export JAVA_HOME=$PWD/j2sdk1.4.0_01 export PATH=$PATH:$JAVA_HOME/bin |
Unzip and set the install of j2sdk by running the following commands:
for i in ../j2sdk-1_4_0-*.zip; do unzip $i; done &&
patch -Np1 -i ../j2sdk-gcc31.patch &&
export SRC=$PWD &&
export ALT_BOOTDIR="$JAVA_HOME" &&
export ALT_MOTIF_DIR=$SRC &&
export ALT_MOZILLA_PATH=$SRC &&
export ALT_DEVTOOLS_PATH="/usr/bin" &&
export MILESTONE="blfscompiled" &&
export BUILD_NUMBER=`date +%s` &&
export DEV_ONLY=true &&
export OTHER_LDFLAGS="-lpthread" &&
unset JAVA_HOME &&
unset CLASSPATH &&
export OTHER_CFLAGS=${CFLAGS} &&
export OTHER_CXXFLAGS=${CXXFLAGS} &&
unset CFLAGS &&
unset CXXFLAGS
|
Make will not find cpio unless it is in the /usr directory. Create this link with the following command:
ln -s /usr/bin/cpio /bin/cpio |
Make and Install j2sdk with the following commands:
cd $SRC/control/make && make && cd $SRC/control/build/linux-i386 && mkdir -p /opt/java && cp -a j2sdk-image /opt/java/j2sdk-1.4.0 && cd /opt/java && ln -s j2sdk-1.4.0 j2sdk |
Test the installation with the following commands:
export JAVA_HOME=/opt/java/j2sdk && $JAVA_HOME/jre/bin/java -version |
If you get a version line, a description of the runtime environment and a desrciption of the client VM (virtual machine), you are ready to go.
export JAVA_HOME=$PWD/j2sdk1.4.0_01 : This command sets the location of the working java.
export ALT_BOOTDIR="$JAVA_HOME" : This command set the compiler variable that will execute the java compiler when needed during make.
export ALT_MOTIF_DIR=$SRC : This sets the variable that points to where you unzipped the motif headers.
export ALT_MOZILLA_PATH=$SRC : This sets the variable that points to where you unzipped the mozilla headers.
export ALT_DEVTOOLS_PATH="/usr/bin" : This changes the default to the correct value.
export ALT_MILESTONE="blfscompiled" : This will help you identify this compiled version of java by appending this to the version in the output to "java -version".
export BUILD_NUMBER=`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.
export OTHER_LDFLAGS="-lpthread" : This command corrects compiling errors related to the pthread variables.
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.
export OTHER_CFLAGS=${CFLAGS} : This makes j2sdk compile using your CFLAGS for optimizations.
export OTHER_CXXFLAGS=${CXXFLAGS} : This makes j2sdk compile using your CXXFLAGS for optimizations.
unset CFLAGS : Now that the optimizations are loaded, this clears the variable.
unset CXXFLAGS : Now that the optimizations are loaded, this clears the variable.
/etc/profile, ~/.bash_profile, ~/.profile, ~/.bashrc
Add the following lines to the appropriate file listed above.
export JAVA_HOME=/opt/java/j2sdk export PATH=$PATH:$JAVA_HOME/bin |
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.
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 verifys 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 that class's 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 anddocumentation 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.
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 charaters.
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.