<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
   "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
  <!ENTITY % general-entities SYSTEM "../../general.ent">
  %general-entities;

  <!ENTITY anduin-download             "http://anduin.linuxfromscratch.org/files/BLFS/OpenJDK-&openjdk-version;">
  <!ENTITY openjdk-download-binary-x86 "&anduin-download;/OpenJDK-&openjdk-version;-i686-bin.tar.xz">
  <!ENTITY openjdk-bin-md5sum-x86      "da24f4f123ea149924932779cc81b947">
  <!ENTITY openjdk-bin-size-x86        "57 MB">
  <!ENTITY openjdk-bin-buildsize-x86   "165 MB">

  <!ENTITY openjdk-download-binary-x64 "&anduin-download;/OpenJDK-&openjdk-version;-x86_64-bin.tar.xz">
  <!ENTITY openjdk-bin-md5sum-x64      "140784dc0dc976d238517b1689cda4e2">
  <!ENTITY openjdk-bin-size-x64        "57 MB">
  <!ENTITY openjdk-bin-buildsize-x64   "169 MB">
]>

<sect1 id="java" xreflabel="Java-&openjdk-version;">
  <?dbhtml filename="java.html"?>

  <sect1info>
    <othername>$LastChangedBy: pierre $</othername>
    <date>$Date: 2015-03-04 17:17:44 -0500 (Wed, 04 Mar 2015) $</date>
  </sect1info>

  <title>Java-&openjdk-version;</title>

  <indexterm zone="java">
    <primary sortas="a-java">JDK Binary</primary>
  </indexterm>


  <sect2>
    <title>About Java</title>
    <para>Java is different from most of the packages in LFS and BLFS. It
    is a programming language that works with files of byte codes to obtain
    instructions and executes then in a Java Virtual Machine (JVM). An 
    introductory java program looks like:</para>

<screen><literal>public class HelloWorld 
{
    public static void main(String[] args) 
    {
        System.out.println("Hello, World");
    }
}</literal></screen>

    <para>This program is saved as <filename>HelloWorld.java</filename>. The
    file name, <emphasis>HelloWorld</emphasis>, must match the class name. It
    is then converted into byte code with
    <command>javac HelloWorld.java</command>. The output file is
    <filename>HelloWorld.class</filename>.  The program is executed with
    <command>java HelloWorld</command>.  This creates a JVM and runs the
    code.  The 'class' extension must not be specified.</para>

    <para>Several class files can be combined into one file with the
    <command>jar</command> command. This is similar to the standard
    <command>tar</command> command. For instance, the command
    <command>jar cf myjar.jar *.class</command> will combine all class files
    in a directory into one jar file. These act as library files.</para>

    <para>The JVM can search for and use classes in jar files automatically.
    It uses the <envar>CLASSPATH</envar> environment variable to search for
    jar files. This is a standard list of colon-separated directory names
    similar to the <envar>PATH</envar> environment variable.</para>
 
  </sect2>

  <sect2 id="java-bin" xreflabel="Java Binary" role="package">
    <title>Binary JDK Information</title>

    <para>Creating a JVM from source requires a set of circular dependencies.
    The first thing that's needed is a set of programs called a Java Development
    Kit (JDK).  This set of programs includes <command>java</command>,  
    <command>javac</command>, <command>jar</command>, and several others. It 
    also includes several base <emphasis>jar</emphasis> files.</para>

    <para>To start, we set up a binary installation of the JDK created
    by the BLFS editors.  It is installed in the <filename>/opt</filename>
    directory to allow for multiple installations, including a source based
    version.</para>

    &lfs77_checked;

    <bridgehead renderas="sect3">Binary Package Information</bridgehead>
    <itemizedlist spacing="compact">
      <listitem>
        <para>Binary download (x86):
        <ulink url="&openjdk-download-binary-x86;"/></para>
      </listitem>
      <listitem>
        <para>Download MD5 sum: &openjdk-bin-md5sum-x86;</para>
      </listitem>
      <listitem>
        <para>Download size (binary): &openjdk-bin-size-x86;</para>
      </listitem>
      <listitem>
        <para>Estimated disk space required: &openjdk-bin-buildsize-x86;</para>
      </listitem>
    </itemizedlist>
    <itemizedlist spacing="compact">
      <listitem>
        <para>Binary download (x86_64):
        <ulink url="&openjdk-download-binary-x64;"/></para>
      </listitem>
      <listitem>
        <para>Download MD5 sum: &openjdk-bin-md5sum-x64;</para>
      </listitem>
      <listitem>
        <para>Download size (binary): &openjdk-bin-size-x64;</para>
      </listitem>
      <listitem>
        <para>Estimated disk space required: &openjdk-bin-buildsize-x64;</para>
      </listitem>
    </itemizedlist>

    <bridgehead renderas="sect3">Java Binary Runtime Dependencies</bridgehead>
    <para role="required">
      <xref linkend="alsa-lib"/>,
      <xref linkend="cups"/>,
      <xref linkend="giflib"/>, and
      <xref linkend="xorg7-lib"/>
    </para>

  </sect2>

  <sect2 role="installation">
    <title>Installation of the Java BinaryJDK </title>
    <para>Begin by extracting the appropriate binary tarball for your
    architecture and changing to the extracted directory. Install the binary
    <application>OpenJDK</application> with the following commands as the
    <systemitem class="username">root</systemitem> user:</para>

<screen role="root"><userinput>install -vdm755 /opt/OpenJDK-&openjdk-version;-bin &amp;&amp;
mv -v * /opt/OpenJDK-&openjdk-version;-bin         &amp;&amp;
chown -R root:root /opt/OpenJDK-&openjdk-version;-bin</userinput></screen>

<!--
    <para>Configure the temporary <application>OpenJDK</application>
    installation by issuing the following commands (note that if you logout
    and login back before having definitely configured
    <xref linkend='openjdk'/>, you'll have to issue them again):</para>

<screen><userinput>export CLASSPATH=.:/usr/share/java &amp;&amp;
export JAVA_HOME=/opt/OpenJDK-&openjdk-version;-bin &amp;&amp;
export PATH="$PATH:/opt/OpenJDK-&openjdk-version;-bin/bin"</userinput></screen>

    <para>You may also include those instructions into a file in the <filename
    class="directory">/etc/profile.d</filename> directory. Do not forget to
    logout and login back, or to source the profile file after
    modification.</para>
-->

    <para>
      The binary version is now installed. You may create a symlink to that
      version by issuing, as the <systemitem class="username">root</systemitem>
      user:
    </para>

<screen role="root"><userinput>ln -sf OpenJDK-&openjdk-version;-bin /opt/jdk</userinput></screen>

    <para>
      You may now proceed to <xref linkend="ojdk-conf"/>, where the
      instructions assume that the above link exists.
    </para>

<!--
If you don't want to compile the
      sources, skip ahead to the <xref linkend='openjdk-config'/> section.
    Otherwise, continue to the <xref linkend='apache-ant'/>,
    <xref linkend='junit'/>, and <xref linkend='openjdk'/> sections.</para>
-->
    
  </sect2>

</sect1>
