<?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;
]>

<sect1 id="ojdk-conf" xreflabel="Configuring the JAVA environment">
  <?dbhtml filename="ojdk-conf.html"?>

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

  <title>Configuring the JAVA environment</title>

    <para>
      After the package installation is complete, the next step is to make sure
      that the system can properly find the files.  If you set up your login
      scripts as recommended in <xref linkend='postlfs-config-profile'/>, update
      the environment by creating the <filename>openjdk.sh</filename> script,
      as the <systemitem class="username">root</systemitem> user:
    </para>

<screen role="root"><userinput>cat &gt; /etc/profile.d/openjdk.sh &lt;&lt; "EOF"
<literal># Begin /etc/profile.d/openjdk.sh

# Set JAVA_HOME directory
JAVA_HOME=/opt/jdk

# Adjust PATH
pathappend $JAVA_HOME/bin

# Add to MANPATH
pathappend $JAVA_HOME/man MANPATH

# Auto Java CLASSPATH: Copy jar files to, or create symlinks in, the
# /usr/share/java directory. Note that having gcj jars with OpenJDK 8
# may lead to errors.

AUTO_CLASSPATH_DIR=/usr/share/java

pathprepend . CLASSPATH

for dir in `find ${AUTO_CLASSPATH_DIR} -type d 2>/dev/null`; do
    pathappend $dir CLASSPATH
done

for jar in `find ${AUTO_CLASSPATH_DIR} -name "*.jar" 2>/dev/null`; do
    pathappend $jar CLASSPATH
done

export JAVA_HOME
unset AUTO_CLASSPATH_DIR dir jar

# End /etc/profile.d/openjdk.sh</literal>
EOF</userinput></screen>

    <para>
      For allowing <command>mandb</command> to include the OpenJDK man pages
      in its database, issue, as the <systemitem class="username">root
      </systemitem> user:
    </para>

<screen role="root"><userinput>cat &gt;&gt; /etc/man_db.conf &lt;&lt; "EOF" &amp;&amp;
<literal># Begin Java addition
MANDATORY_MANPATH     /opt/jdk/man
MANPATH_MAP           /opt/jdk/bin     /opt/jdk/man
MANDB_MAP             /opt/jdk/man     /var/cache/man/jdk
# End Java addition</literal>
EOF

mkdir -p /var/cache/man
mandb -c /opt/jdk/man</userinput></screen>

    <para>
      The installation of the JRE Certificate Autority Certificates (cacerts)
      is described in the <xref linkend="ojdk-certs"/> section.
      If you are using the binary version, those certificates may already be
      installed.
    </para>

</sect1>
