wiki:jdk

Version 6 (modified by DJ Lucas, 13 years ago) ( diff )

--

JDK

If you are building JDK, KSH is necessary during the compile.

If your X Window System is installed anywhere other than /usr/X11R6, and you are building from JRL source:

Until the upstream source is fixed, you can use the following commands to modify the appropriate files without having the /usr/X11R6 compatibility symlink. Be sure to replace both instances of <$PREFIX> in the code block below with the appropriate path.

for file in `find . -name Makefile \
    -or -name Imakefile -or -name *.gmk`
do 
    sed -i 's@/usr/X11R6@<$PREFIX>@g' $file
done &&
sed -i 's@/usr/X11R6@<$PREFIX>@g' \
    j2se/src/solaris/native/sun/awt/fontpath.c \
    j2se/src/solaris/classes/sun/awt/motif/linux.fontconfig.Sun.properties \
    j2se/src/solaris/classes/sun/awt/motif/linux.fontconfig.RedHat.3.properties

If you use a timestamp based packager (install-log)

If you are using a package manager that logs installations such as install-log, you will need to touch each file after installation. Use the following commands:

for file in `find /opt/jdk/ -type f`
do
   touch $file
done

OpenJDK-6 (IcedTea-6)

First, BLFS-6.3 is the minimum target and you must have a working Ant (which requires a JDK), and GTK+.

Next, you will need GCJ-4.3.0 or better (gcc-4.3.2 at the time of writing). Install it using the following instructions:

sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in &&
sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in &&
sed -i 's/@have_mktemp_command@/yes/' gcc/gccbug.in &&
mkdir ../gcc-build &&
cd ../gcc-build &&
../gcc-4.3.2/configure \
    --prefix=/opt/gcc-4.3.2 \
    --libexecdir=/usr/lib \
    --enable-shared \
    --enable-threads=posix \
    --enable-__cxa_atexit \
    --enable-clocale=gnu \
    --enable-languages=c,c++,java &&
make &&
sudo make install &&
sudo ln -v -sf `find /opt/gcc-4.3.2/lib/gcc -name ffitarget.h` \
    /opt/gcc-4.3.2/include

Next, you will need to install several freely available jars into our new gcc directory (to isolate them from the rest of the system).

  1. ftp://ftp.mozilla.org/pub/mozilla.org/js/rhino1_7R1.zip
    cp *.jar /opt/gcc-4.3.2/share/java/
    
  1. http://ftp.wayne.edu/apache/xml/xalan-j/binaries/xalan-j_2_7_0-bin.tar.gz
    cp *.jar /opt/gcc-4.3.2/share/java/
    
  2. http://ftp.osuosl.org/pub/eclipse/eclipse/downloads/drops/S-3.5M1-200808071402/ecj-3.5M1.jar
    cp ecj-3.5M1.jar /opt/gcc-4.3.2/share/java/
    

Now, you will need to download and install a little gcj-compat package from RedHat. We could do all of this manually, but despite the long list of commands, this is much easier. ftp://sources.redhat.com/pub/rhug/java-gcj-compat-1.0.77.tar.gz

./configure --prefix=/opt/gcc-4.3.2 &&
sudo make install &&
sudo ln -vsf ../../../../bin/gjar \
    /opt/gcc-4.3.2/lib/jvm/java-1.5.0-gcj-1.5.0.0/bin/jar &&
sudo ln -vsf ../../../../bin/gjavah \
    /opt/gcc-4.3.2/lib/jvm/java-1.5.0-gcj-1.5.0.0/bin/javah &&
sudo rm -rf /opt/gcc-4.3.2/lib/jvm/java-1.5.0-gcj-1.5.0.0/include &&
sudo ln -vsf ../../../lib/gcc/i686-pc-linux-gnu/4.3.2/include \
    /opt/gcc-4.3.2/lib/jvm/java-1.5.0-gcj-1.5.0.0/include &&
sudo rm -rf /opt/gcc-4.3.2/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre/lib/i386 &&
sudo ln -vsf ../../../../../lib/gcj-4.3.2-9 \
    /opt/gcc-4.3.2/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre/lib/i386

Ignore the unresolved javadoc symlink, it is not needed, but can be fufilled by gjdoc if you prefer (good luck, it's also a PITA deserving it's own wiki page).

Now download IcedTea6 from the git repository (or release when available) http://icedtea.classpath.org/hg/icedtea6/ (click the bz2 link).

You will also need the latest OpenJDK-6 source tarball...you will not need to download the binary plugs as free alternatives are provided by IcedTea. http://download.java.net/openjdk/jdk6/

Now extract the IcedTea6 tarball, and copy the OpenJDK-6 tarball into the extracted directory.

NOTE: Below we create three symlinks in the main filesystem. This is done to avoid adding another patch to the growing list of patches in IcedTea-6. To create a patch is trivial, however, the patch would have to be updated frequently to keep up with development since it patches the downloaded openjdk6 source files, which are not yet in the tree. The symlink method is much easier until a stable release is made.

NOTE: As of 20080916, a patch has been submitted upstream to fix a build error. http://www.linuxfromscratch.org/~dj/icedtea6-fix-ATFILE.patch Check the changelog to see if you still need it.

Building the beast:

unset JAVA_HOME &&
unset CLASSPATH &&
sudo ln -s /opt/ant/bin/ant /usr/bin &&
sudo ln -s /usr/bin/touch /bin &&
sudo ln -s /bin/find /usr/bin &&
./autgen.sh &&
./configure \
    --with-ant-home=/opt/ant \
    --with-libgcj-jar=/opt/gcc-4.3.2/share/java/libgcj-4.3.2.jar \
    --with-gcj-home=/opt/gcc-4.3.2/lib/jvm/java-1.5.0-gcj-1.5.0.0 \
    --with-java=/opt/gcc-4.3.2/bin/gij \
    --with-jar=/opt/gcc-4.3.2/bin/gjar \
    --with-rmic=/opt/gcc-4.3.2/bin/grmic \
    --with-javah=/opt/gcc-4.3.2/bin/gjavah \
    --with-ecj-jar=/opt/gcc-4.3.2/share/java/ecj-3.5M1.jar \
    --with-xalan2-jar=/opt/gcc-4.3.2/share/java/xalan.jar \
    --with-xalan2-serializer-jar=/opt/gcc-4.3.2/share/java/serializer.jar \
    --with-xerces2-jar=/opt/gcc-4.3.2/share/java/xercesImpl.jar \
    --with-rhino=/opt/gcc-4.3.2/share/java/js.jar &&
make

Go get some coffee, or lunch, a late night snack, take a nap, go to bed...and 2-3 hours later:

Install the beast:

sudo cp -a j2sdk-image /opt/openjdk-1.6.0_0-b12 &&
sudo rm /opt/jdk &&
sudo ln -sfv openjdk-1.6.0_0-b12 /opt/jdk &&
sudo rm /opt/jdk/jre/lib/rhino.jar &&
sudo cp /opt/gcc-4.3.2/share/java/js.jar /opt/jdk/jre/lib/rhino.jar

If you've used the BLFS instructions to install the original Sun JDK, for Ant, then all you need to do is refresh your profile...unless you want to use the browser plugin. The browser plugin is located at /opt/jdk/jre/lib/i386/gcjwebplugin.so and it should be symlinked just like in the current JDK instructions. Close the browser and reopen after refreshing your profile.

That's it. Hope you enjoy.

Up
Top

Note: See TracWiki for help on using the wiki.