glfs/general/prog/j2sdk.xml
Bruce Dubbs 52d29f7a42 XML Updates to Part III from DJ
git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@2304 af4574ff-66df-0310-9fd7-8a98e5e911e0
2004-06-12 22:56:28 +00:00

409 lines
22 KiB
XML

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../../general.ent">
%general-entities;
<!ENTITY j2sdk-download-http "http://freshmeat.net/projects/sunjdk">
<!ENTITY j2sdk-download-ftp " ">
<!ENTITY j2sdk-bin-size "35 MB">
<!ENTITY j2sdk-src-size "77 MB">
<!ENTITY j2sdk-src-buildsize "1810 MB">
<!ENTITY j2sdk-time "85 SBU">
]>
<sect1 id="j2sdk" xreflabel="J2SDK-&j2sdk-src-version;">
<?dbhtml filename="j2sdk.html" ?>
<title>J2SDK-&j2sdk-src-version;</title>
<sect2>
<title>Introduction to j2sdk</title>
<para>The <application>J2SDK</application> package contains Sun's
<application>Java</application> development environment. This is useful for
developing <application>Java</application> programs and provides the runtime
environment necessary to run <application>Java</application> programs. It also
includes a plug-in for browsers so that they can be <application>Java
</application> aware.</para>
<para>
The <acronym>JDK</acronym> comes in two flavors, a precompiled binary and a
source package. Previously, the plugin included in the <acronym>JDK</acronym> binary
package was unusable on <acronym>LFS</acronym>
owing to incompatibilities with <acronym>GCC</acronym>-3 compiled browsers.
This is not the case anymore.</para>
<para>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.</para>
<para>Even if you plan on compiling the <acronym>JDK</acronym> source, you will
need to download the binary version to bootstrap the <acronym>JDK</acronym>
build. Follow the link below to download both source and binary packages. When
downloading the source also download the <application>Mozilla</application>
headers package available at the same location.</para>
<!--
<para>For users who cannot download the <application>J2SDK</application> source owing to license restrictions, <application>blackdown
</application> has an <acronym>GCC</acronym>-3 based precompiled version.
Check out <ulink url="http://www.blackdown.org/"/> for more
information.</para>
-->
<sect3><title>Package information</title>
<itemizedlist spacing='compact'>
<listitem><para>Download (HTTP): <ulink
url="&j2sdk-download-http;"/></para></listitem>
<!--
<listitem><para>Download (FTP): <ulink
url="&j2sdk-download-ftp;"/></para></listitem>
-->
<listitem><para>Version used (binary):
&j2sdk-bin-version;</para></listitem>
<listitem><para>Download size (binary): &j2sdk-bin-size;</para></listitem>
<listitem><para>Download size (source): &j2sdk-src-size;</para></listitem>
<listitem><para>Estimated Disk space required:
&j2sdk-src-buildsize;</para></listitem>
<listitem><para>Estimated build time:
&j2sdk-time;</para></listitem></itemizedlist>
</sect3>
<sect3><title>Additional downloads</title>
<itemizedlist spacing='compact'>
<listitem><para><ulink url="&patch-root;/j2sdk-1.4.2-fix-inline-asm-1.patch"/></para></listitem>
<listitem><para><ulink url="&patch-root;/j2sdk-1.4.2-gcc33-1.patch"/></para></listitem>
<listitem><para><ulink url="&patch-root;/j2sdk-1.4.2-motif-mkmsgcat.patch"/></para></listitem>
<listitem><para><ulink url="&patch-root;/j2sdk-1.4.2-remove-debug-image.patch"/></para></listitem>
<listitem><para><ulink url="&patch-root;/j2sdk-1.4.2-remove-fixed-paths-1.patch"/></para></listitem>
<listitem><para><ulink url="&patch-root;/j2sdk-1.4.2-static_cxx.patch"/></para></listitem>
<listitem><para><ulink url="&patch-root;/j2sdk-1.4.2-ash.patch"/> (Only required if /bin/sh is symlinked to <xref linkend="ash"/>)</para></listitem>
</itemizedlist>
</sect3>
<sect3><title><application>J2SDK</application> dependencies</title>
<sect4><title>Required</title>
<para>X (<xref linkend="xfree86"/> or <xref linkend="xorg"/>), <xref linkend="zip"/>, <xref
linkend="unzip"/>, <xref linkend="cpio"/>, <xref linkend="alsa"/>,
and <xref linkend="tcsh"/>
</para></sect4>
</sect3>
</sect2>
<sect2>
<title>Installation of <application>J2SDK</application></title>
<para>Both versions will be installed in parallel. You may choose to keep
either or both.</para>
<para>Installation of the precompiled <acronym>JDK</acronym> is easy:
create a directory to install from, copy the .bin there, and run the
following commands:</para>
<screen><userinput><command>VERSION=&j2sdk-bin-version; &amp;&amp;
MV=`echo $VERSION | cut -d "_" -f 1,1` &amp;&amp;
V=`echo ${VERSION} | sed -e "s/\./_/g"` &amp;&amp;
sed -i "s:^PATH=.*::" j2sdk-${V}-linux-i?86.bin &amp;&amp;
chmod +x j2sdk-${V}-linux-i?86.bin &amp;&amp;
mkdir -p bin &amp;&amp;
ln -sf /bin/true bin/more &amp;&amp;
yes | PATH=$PWD/bin:$PATH ./j2sdk-${V}-linux-i?86.bin &amp;&amp;
cd j2sdk${VERSION} &amp;&amp;
install -d /opt/j2sdk/j2sdk-precompiled-${MV} &amp;&amp;
mv * /opt/j2sdk/j2sdk-precompiled-${MV}</command></userinput></screen>
<para>The binary version is now installed. </para>
<para>If you don't want to compile the source or are not in a postition to download the source
owing to license restrictions, skip ahead to the configuration
section.</para>
<para>Add the recently compiled <acronym>JDK</acronym> to the path.</para>
<screen><userinput><command>export JAVA_HOME=/opt/j2sdk/j2sdk-precompiled-${MV} &amp;&amp;
export PATH=$PATH:${JAVA_HOME}/bin</command></userinput></screen>
<para>Unzip the source:</para>
<screen><userinput><command>VERSION=&j2sdk-src-version; &amp;&amp;
V=`echo $VERSION | sed -e "s/\./_/g"` &amp;&amp;
unzip j2sdk-${V}-src-scsl.zip &amp;&amp;
unzip j2sdk-${V}-mozilla_headers-unix.zip &amp;&amp;
unzip j2sdk-${V}-bin-scsl.zip</command></userinput></screen>
<para>Apply all the patches downloaded above.</para>
<screen><userinput><command>for PATCH in fix-inline-asm-1 gcc33-1 motif-mkmsgcat \
remove-debug-image remove-fixed-paths-1 \
static_cxx
do
patch -Np1 -i j2sdk-1.4.2-$PATCH.patch
done</command></userinput></screen>
<para>Set/unset some variables which affect the build:</para>
<screen><userinput><command>export ALT_BOOTDIR="$JAVA_HOME" &amp;&amp;
unset JAVA_HOME &amp;&amp;
unset CLASSPATH
unset CFLAGS
unset CXXFLAGS
unset LDFLAGS
export ALT_DEVTOOLS_PATH="/usr/bin" &amp;&amp;
export BUILD_NUMBER="blfs-`date +%s`" &amp;&amp;
export DEV_ONLY=true &amp;&amp;
export ALT_MOZILLA_PATH=$PWD &amp;&amp;
export INSANE=true &amp;&amp;
export MAKE_VERBOSE=true &amp;&amp;
export ALT_CACERTS_FILE=${ALT_BOOTDIR}/jre/lib/security/cacerts</command></userinput></screen>
<warning><para>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.</para></warning>
<para>Additionally, if you would like to make in parallel, add the following
(adjust <envar>MAKE_PARALLEL</envar> to your liking):</para>
<screen><userinput><command>export HOTSPOT_BUILD_JOBS=$MAKE_PARALLEL</command></userinput></screen>
<para>If the included <application>Motif</application> doesn't build properly, the
error is noticed much later in the build.
A solution is to build the <application>Motif</application>
library before compiling the <application>J2SDK</application>.</para>
<screen><userinput><command>cd motif/lib/Xm &amp;&amp;
make &amp;&amp;
cd ../../..</command></userinput></screen>
<para>Make and Install <application>J2SDK</application> 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.</para>
<screen><userinput><command>cd control/make &amp;&amp;
make &amp;&amp;
cd ../.. &amp;&amp;
cd control/build/linux-i?86 &amp;&amp;
cp -a j2sdk-image /opt/j2sdk/j2sdk-&j2sdk-src-version;</command></userinput></screen>
</sect2>
<sect2>
<title>Command explanations</title>
<para><command>export ALT_BOOTDIR="$JAVA_HOME"</command>: This var sets
location of the bootstrap <acronym>JDK</acronym>.
</para>
<para><command>export ALT_MOZILLA_PATH=$PWD</command>: This sets the
variable that points to where you unzipped the <application>Mozilla
</application> headers.</para>
<para><command>export ALT_DEVTOOLS_PATH="/usr/bin"</command>: This
changes the location where the build finds the needed executables.
</para>
<para><command>export BUILD_NUMBER="blfs-`date +%s`"</command>: 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 <command>java -version</command>.</para>
<para><command>export DEV_ONLY=true</command>: This command
eliminates compiling the documentation and eliminates a dependency for
<application>rpm</application>. </para>
<para><command>unset JAVA_HOME</command>: This clears the
<envar>JAVA_HOME</envar>
variable as recommended by the build instructions.</para>
<para><command>unset CLASSPATH</command>: This clears the
<envar>CLASSPATH</envar> variable as per the recommendations in the build instructions.
</para>
<para><command>unset CFLAGS...</command>: These flags cause miscompilation
of the build. Never set these.</para>
<para><command>export INSANE=true</command>: 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.</para>
<para><command>export MAKE_VERBOSE=true</command>: Allows the current
compilation command to be displayed on the console.</para>
<para><command>export ALT_CACERTS_FILE...</command>: Specifies the
certificate file to use.</para>
</sect2>
<sect2>
<title>Configuring <application>J2SDK</application></title>
<sect3><title>Configuration Information</title>
<para>We have two Java 2 <acronym>SDK</acronym>'s installed in
<filename>/opt/j2sdk</filename>. Decide on which one you
would like to use as the default. For example if you decide to use the source
compiled <application>J2SDK</application>, do the following:</para>
<screen><userinput><command>ln -nsf j2sdk-&j2sdk-src-version; /opt/j2sdk/j2sdk</command></userinput></screen>
<para>Add the following lines to your shell startup file (e.g.,
<filename>/etc/profile</filename>).</para>
<screen><userinput>export JAVA_HOME=/opt/j2sdk/j2sdk
export PATH=$PATH:$JAVA_HOME/bin</userinput></screen>
<para>Add <filename>$JAVA_HOME/man</filename> to your
<envar>MANPATH</envar> variable or to
<filename>/etc/man.conf</filename></para>
<para>The <application>Java</application> plugin is in the directory
<filename class="directory">$JAVA_HOME/jre/plugin/i?86/ns610/</filename>.
Make a symbolic link to the file in that directory from your plugins directory.</para>
</sect3>
<sect3><title>Handling CLASSPATH</title>
<para>When compiling packages, the <envar>CLASSPATH</envar> environment variable
is used by JDK to locate classes at compile-time and run-time. It is tedious toadd all the classes used to the <envar>CLASSPATH</envar> manually. You may add
the following lines to your shell startup file to set <envar>CLASSPATH</envar>
automatically to include all JAR files in a specified directory, which in
the example below is <filename>/usr/lib/auto-java-classpath</filename>.</para>
<screen><userinput>AUTO_CLASSPATH_DIR=/usr/lib/auto-java-classpath
if [ -z $CLASSPATH ]
then
CLASSPATH=.:$AUTO_CLASSPATH_DIR
else
CLASSPATH=$CLASSPATH:.:$AUTO_CLASSPATH_DIR
fi
for i in $(ls $AUTO_CLASSPATH_DIR/*.jar 2>/dev/null)
do
CLASSPATH=$CLASSPATH:$i
done</userinput></screen>
</sect3>
</sect2>
<sect2>
<title>Contents</title>
<para>The <application>J2SDK</application> package contains
<command>appletviewer</command>,
<command>extcheck</command>, <command>idlj</command>,
<command>jar</command>, <command>jarsigner</command>,
<command>java</command>, <command>javac</command>,
<command>javadoc</command>, <command>javah</command>,
<command>javap</command>, <command>jdb</command>,
<command>keytool</command>, <command>native2ascii</command>,
<command>orbd</command>, <command>policytool</command>,
<command>rmic</command>, <command>rmid</command>,
<command>rmiregistry</command>, <command>rmiregistry</command>,
<command>serialver</command>, <command>servertool</command> and
<command>tnameserv</command>.</para>
</sect2>
<sect2><title>Description</title>
<sect3><title>appletviewer</title>
<para><command>appletviewer</command> runs
<application>Java</application> applets outside of the context of a
browser.</para></sect3>
<sect3><title>extcheck</title>
<para><command>extcheck</command> checks a specified <filename>JAR</filename>
file for title and version conflicts with any extensions installed in the
<acronym>JDK</acronym> software.</para></sect3>
<sect3><title>idlj</title>
<para><command>idlj</command> generates <application>Java</application>
bindings from a given <acronym>IDL</acronym> file.</para></sect3>
<sect3><title>jar</title>
<para><command>jar</command> combines multiple files into a single
<acronym>JAR</acronym> archive file.</para></sect3>
<sect3><title>jarsigner</title>
<para><command>jarsigner</command> signs <filename>JAR</filename>
(Java ARchive) files and verifies the signatures and integrity of a signed
<filename>JAR</filename>.</para></sect3>
<sect3><title>java</title>
<para><command>java</command> launches a <application>Java</application>
application by starting a <application>Java</application> runtime
environment, loading a specified class and invoking its main
method.</para></sect3>
<sect3><title>javac</title>
<para><command>javac</command> reads class and interface definitions, written
in the <application>Java</application> programming language, and compiles them
into bytecode class files.</para></sect3>
<sect3><title>javadoc</title>
<para><command>javadoc</command> parses the declarations and documentation
comments in a set of <application>Java</application> source files and produces
a corresponding set of <acronym>HTML</acronym> pages describing the classes,
interfaces, constructors, methods, and fields.</para></sect3>
<sect3><title>javah</title>
<para><command>javah</command> generates <application>C</application> header
and source files that are needed to implement native methods.</para></sect3>
<sect3><title>javap</title>
<para><command>javap</command> disassembles a
<application>Java</application> class file.</para></sect3>
<sect3><title>jdb</title>
<para><command>jdb</command> is a simple command-line debugger for
<application>Java</application> classes.</para></sect3>
<sect3><title>keytool</title>
<para><command>keytool</command> is a key and certificate management utility.</para></sect3>
<sect3><title>native2ascii</title>
<para><command>native2ascii</command> converts files that contain non-supported
character encoding into files containing Latin-1 or Unicode-encoded characters.</para></sect3>
<sect3><title>orbd</title>
<para><command>orbd</command> is used to enable clients to transparently locate
and invoke persistent objects on servers in the <acronym>CORBA</acronym>
environment.</para></sect3>
<sect3><title>policytool</title>
<para><command>policytool</command> creates and manages a policy file
graphically.</para></sect3>
<sect3><title>rmic</title>
<para><command>rmic</command> generates stub and skeleton class files for
remote objects from the names of compiled <application>Java</application>
classes that contain remote object implementations.</para></sect3>
<sect3><title>rmid</title>
<para><command>rmid</command> starts the activation system daemon.</para>
</sect3>
<sect3><title>rmiregistry</title>
<para><command>rmiregistry</command> creates and starts a remote object
registry on the specified port on the current host.</para></sect3>
<sect3><title>serialver</title>
<para><command>serialver</command> returns the serialVersionUID for one or
more classes in a form suitable for copying into an evolving class.</para>
</sect3>
<sect3><title>servertool</title>
<para><command>servertool</command> provides an ease-of-use interface for
application programmers to register, unregister, startup and shutdown a server.</para></sect3>
<sect3><title>tnameserv</title>
<para><command>tnameserv</command> starts the <application>Java</application>
<acronym>IDL</acronym> name server.</para></sect3>
</sect2>
</sect1>