<?xml version="1.0" encoding="UTF-8"?>
<section version="5.0" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook" xml:lang="en" xml:id="Install_J2ee"><info><title>Installing JOnAS/Tomcat or JOnAS/Jetty from scratch</title></info>
  
  <para>
    This guide provides instructions for installing JOnAS (with a web container already included) from scratch.
  </para>
 <section xml:id="Install_J2ee-JDK"><info><title>J2SE SDK 1.4 installation</title></info>
    
    <para>
      Download the binary version of a 
      <link xlink:href="http://java.sun.com/j2se/1.4/download.html">
        J2SE SDK 1.4
      </link>
       from the 
      <link xlink:href="http://java.sun.com/j2se/">
        java Sun web site
      </link>
       into the appropriate directory. Launch the executable file:
    </para>
    <para>
      <code>
        ./j2sdk-1_&lt;version number&gt;-&lt;system&gt;.bin
      </code>
       for Unix 
      <code>
        ./j2sdk-1_&lt;version number&gt;-&lt;system&gt;.sh
      </code>
       for Linux 
      <code>
         j2sdk-1_&lt;version number&gt;-windows-i586.exe
      </code>
       for Windows
    </para>
    <para>
      Set the JAVA_HOME environment variable and update the path:
    </para>
    <para>
      <code>
        export JAVA_HOME=&lt;Installation Directory&gt; 
         PATH=$JAVA_HOME/bin:$PATH (on Windows : PATH=%JAVA_HOME%/bin;%PATH%)
      </code>
    </para>
  </section>
  <section xml:id="Install_J2ee-Ant"><info><title>ANT 1.6 installation</title></info>
    
    <para>
      Download the binary version of Ant 1.6 from the 
      <link xlink:href="http://ant.apache.org/bindownload.cgi">
        Ant Apache web site
      </link>
      . Untar or Unzip it into the appropriate directory:
    </para>
    <para>
      <code>
        tar -jxvf apache-ant-1.6.1-bin.tar.bz2
      </code>
       (
      or 
      <code>
        unzip apache-ant-1.6.1-bin.zip
      </code>
      )
    </para>
    <para>
      Set the ANT_HOME environment variable and update the path:
    </para>
    <para>
      <code>
        export ANT_HOME=&lt;Installation Directory&gt; 
         PATH=$PATH;$ANT_HOME/bin (on Windows : PATH=%ANT_HOME%/bin;%PATH%)
      </code>
    </para>
    <para>
      Download 
      <code>
        bcel-5.1.tar.gz
      </code>
       from the 
      <link xlink:href="http://www.apache.org/dist/jakarta/bcel/binaries/">
        Jakarta web site
      </link>
       and install bcel-5.1.jar in the directory 
      <code>
        $ANT_HOME/lib.
      </code>
    </para>
  </section>
  <section xml:id="Install_J2ee-JOnAS"><info><title>JOnAS/Web Container installation</title></info>
    
    <para>
      Download the binary version of JOnAS with Tomcat or Jetty from the 
      <link xlink:href="http://forge.objectweb.org/project/showfiles.php?group_id=5">
        ObjectWeb forge web site
      </link>
      . 
       Choose a location for the JOnAS installation. 
       Be aware that if you have already installed a previous version of JOnAS in this location, the new installation will overwrite the existing files, thus customized configuration files may be lost. Therefore, it is prudent to save these files before starting the installation process. 
       The installation process consists of untaring the downloaded file. 
       Change to the directory in which JOnAS will be installed and untar this file, using 
       the 
      <code>
        tar -zxvf jonas.tgz
      </code>
       command. Note that this file can be opened with winzip on Windows. 
       After installing the JOnAS product, set the following environment variable:
    </para>
    <para>
      <code>
        export JONAS_ROOT = &lt;Installation Directory&gt; 
         PATH = $JONAS_ROOT/bin/unix:$PATH (on Windows: PATH=%JONAS_ROOT%/bin/nt;%PATH%)
      </code>
    </para>
  </section>
  <section xml:id="Install_J2ee-Setup"><info><title>Setup</title></info>
    
    <para>
      Before using JOnAS, complete the following setup activities:
    </para>
    <itemizedlist>
      <listitem><para>
        If a 
        <code>
          CATALINA_HOME
        </code>
         or 
        <code>
          CATALINA_BASE
        </code>
         or     
        <code>
          JETTY_HOME
        </code>
         environment variable has already been set, it     should be unset. JOnAS will set these variables, without requiring any     modifications.
      </para></listitem>
      <listitem><para>
        Based on the data source being used, create a file 
        <code>
          &lt;data     source&gt;.properties
        </code>
         (templates are located in the directory     
        <code>
          $JONAS_ROOT/conf
        </code>
        ). Then add the data source file name     (without the extension 
        <code>
          .properties
        </code>
        ) to the     
        <code>
          jonas.properties
        </code>
         file: 
        <code>
          jonas.service.dbm.datasource       &lt;data source&gt;
        </code>
             Add the JDBC driver in 
        <code>
          $JONAS_ROOT/lib/ext
        </code>
         or in      
        <code>
          $JONAS_BASE/lib/ext
        </code>
         directory.
      </para></listitem>
      <listitem><para>
        If required, configure the Mail service (for PetStore or the example     mailsb, for example). JOnAS provides two types of mail factories:     
        <code>
          javax.mail.Session
        </code>
         and     
        <code>
          javax.mail.internet.MimePartDataSource
        </code>
        . Two types of files     that can be adapted to fit your installation are located in the directory     
        <code>
          $JONAS_ROOT/conf
        </code>
        : 
        <code>
          MailSession1.properties
        </code>
         and     
        <code>
          MailMimePartDS1.properties
        </code>
        . Then, in the     
        <code>
          jonas.properties
        </code>
         file, define the     
        <code>
          jonas.service.mail.factories
        </code>
         property: 
        <code>
          jonas.service.mail.factories       MailSession1,MailMimePartDS1
        </code>
      </para></listitem>
    </itemizedlist>
  </section>
  <section xml:id="Install_J2ee-Start"><info><title>Starting JOnAS and running some examples</title></info>
    
    <para>
      If the 
      <xref linkend="Install_J2ee-Setup" />
       has not been completed as described, JOnAS may not 
        work
      . 
       Use the command 
      <code>
        jonas check
      </code>
       to verify that the environment is correct.
    </para>
    <para>
       If the environment is 
        correct
      , JOnAS is 
      ready
       to use. 
       Do a 
      <code>
        jonas start
      </code>
      , then use a browser to go 
      <link xlink:href="http://localhost:9000/">
        http://localhost:9000/
      </link>
      . (
      Modify this url with the appropriate hostname
      .) 
       From the root context in which JOnAS was deployed, you can execute the earsample, access the JOnAS administration application, as well as perform other functions. 
    </para>
  </section>
</section>