<?xml version="1.0"?>
<!DOCTYPE document SYSTEM "./dtd/document-v10.dtd">

<!--

   Copyright 2000-2004  The Apache Software Foundation 

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

-->
<!-- ====================================================================== -->
<!-- version $Id$ -->
<!-- ====================================================================== -->
<document>
  <header>
    <title>Installing Batik</title>
    <authors>
      <person name="Christophe Jolif" email="cjolif@ilog.fr"/>
      <person name="Vincent Hardy" email="vincent.hardy@eng.sun.com"/>
    </authors>
  </header>

  <body>
    <s1 title="Introduction">
      <p>This page discusses the following Batik installation issues:</p>
      <ul>
        <li><link href="#systemRequirements">System requirements</link></li>
        <li><link href="#distributions"
            >Choosing a distribution to download</link></li>
        <li><link href="#optionalComponents">Optional components</link></li>
        <li><link href="#jarFiles">Jar file dependencies</link></li>
        <li><link href="#verify">Verifying a distribution</link></li>
      </ul>
    </s1>

    <anchor id="systemRequirements" />
    <s1 title="System Requirements">
      <p>
        Batik requires the following systems to be already
        installed in your system:
      </p>
      <ul>
        <li><strong>Java Virtual Machine</strong>
          A Java 1.3 or greater compatible virtual machine must be present. 
        </li>
      </ul>
    </s1>

    <anchor id="distributions" />
    <s1 title="Choosing a distribution to download">

      <p>To install Batik, you will need to go to the <link
          href="http://www.apache.org/dyn/closer.cgi/xml/batik">download area</link> and download one or more
        ZIP file containing the distribution of your choice. It is
        good practice to <link href="#verify">verify the
          integrity</link> of the distribution files, especially if
        you are using one of our mirror sites. Here are the
        various components you will find in the download area and
        their intended use:</p>
      <ul>
        <li><strong>batik-</strong><em>version</em><strong>.zip</strong> (e.g., <code>batik-1.5.zip</code>)<br/>
          The <em>binary distribution</em> contains a compiled
          executable JAR files that let you get started with
          Batik easily. This  is the recommended distribution
          if you want to look at Batik's features, or you want
          to experiment with SVG and see the fun things you can
          do with Batik. The binary distribution comes with a
          set of sample SVG files.</li>

        <li><strong>batik-src-</strong><em>version</em><strong>.zip</strong> 
          (e.g., <code>batik-src-1.5.zip</code>)<br/>
          The <em>source
            distribution</em> contains a complete snapshot of
          the Batik source code, documentation, regression tools
          and utilities as well as the script for building
          Batik. That distribution is a snapshot of the SVN
          repository. This is the recommended distribution for
          developers who want to dive into the code and
          understand how Batik can be integrated in their
          applications or how Batik can be extended. </li>

        <li><strong>batik-docs-</strong><em>version</em><strong>.zip</strong><br/>
          The <em>documentation bundle</em> contains a copy of 
          the Javadoc for the Batik source code.</li>
      </ul>

      <p>We make nightly copies of the source tree available from the
      <link href="http://svn.apache.org/builds/xml-batik">Apache
      build</link> server. These builds represent the current state of
      development and may or may not be as stable as releases.
      There are two types of distributions provided.</p>
      <ul>
        <li><strong>batik-svn-</strong><em>date</em><strong>.zip</strong>
          or <strong>batik-cvs-</strong><em>date</em><strong>.zip</strong>
          (e.g., <code>batik-svn-03-09-26.zip</code>)<br/> 

          This contains a complete copy of the SVN (or old CVS) tree,
          including support for running <link href="test.html">regard</link>
          Batik's regression testing utility.  In particular this
          includes all the reference images for testing.  Developers
          are encouraged to get these or better use <link
          href="svn.html">SVN</link> directly.
        </li>
        <li><strong>batik-src-</strong><em>date</em><strong>.zip</strong>
          (e.g., <code>batik-src-03-09-26.zip</code>)<br/> 

          This contains all the source code and libraries needed to
          build and run Batik from source. But does not include the
          testing facilities.
        </li>
      </ul>

      <p>Older releases are available from the <link
      href="http://archive.apache.org/dist/xml/batik">Apache
      archives</link>.  However, we strongly recommend using
      the current release of Batik.</p>

      <p>In all cases, the user should:</p>

      <ul>
        <li>Make sure a Java Development Kit (JDK) is installed on the
        computer where Batik will be installed. See <link
        href="requirements">System Requirements</link>.  Make sure
        that the <code>java</code> runtime is in the <code>PATH</code>
        environment variable.
        </li>
        <li>Select the directory where he/she wants to download the
        distribution
        </li>

        <li>Download the desired distribution from the <link
        href="http://www.apache.org/dyn/closer.cgi/xml/batik">download
        area</link></li> 

        <li>Download the associated PGP signature (.asc) and KEYS file
        (preferable) or MD5 hash (.md5).  This must be done directly
        from the <link
        href="http://www.apache.org/dist/xml/batik">Apache
        download</link> area to mean anything.</li>

        <li>Open a console and go to the directory
        where the distribution was downloaded.</li>

        <li><link href="#verify">Verify the integrity</link> of the
        distribution</li>

        <li>Unpack the distribution with Java's JAR utility:<br></br>
        <code>jar xvf &lt;distribution&gt;</code><br /> For example,
        if you have downloaded batik-1.5.zip into /home/IamHere, type
        the following at the command prompt:<br /> <code>cd
        /home/IamHere</code><br /> <code>jar xvf
        batik-1.5.zip</code><br /> <strong>IMPORTANT:</strong> UNIX
        users, do not use the <code>unzip</code> utility to unpack the
        various Batik zip files, as this would not set the directories
        access rights properly.
        </li>

        <li>From there, following the instructions specific to the
        application you want to use.  For example, see the <link
        href="svgviewer.html">SVG Browser</link> page or the <link
        href="svgrasterizer.html">SVG Rasterizer</link> page for an
        explanation on how to use these tools.
        </li>
      </ul>

    </s1>

    <anchor id="optionalComponents" />
    <s1 title="Optional Components">
      <p>
        By default, Batik source distribution comes with the <link
          href="http://www.mozilla.org/rhino">Mozilla Rhino</link>
        JavaScript Engine (<code>js.jar</code>).
      </p>
      <p>
        To enable other scripting languages support, you will only
        need to install the correct jar files in <code>lib</code>
        directory of Batik and to recompile your distribution.
      </p>
      <ul>
        <li>
          For Python, you need to download Jython distribution
          at the following URL <link
            href="http://www.jython.org">http://www.jython.org</link>.
          Then you put the <code>jython.jar</code> file in the
          Batik <code> lib</code> directory.
        </li>
        <li>
          For Tcl, you need to download Jacl &amp; TclBlend
          distribution at the following URL <link
            href="http://dev.scriptics.com/software/java/">http://dev.scriptics.com/software/java</link>.
          Then you put the <code>jacl.jar</code> &amp;
          <code>tcljava.jar</code> files in the Batik
          <code>lib</code> directory.
        </li>
      </ul>
      <p>
        Conversely, you can remove the <code>js.jar</code> of the
        Batik <code>lib</code> directory to remove JavaScript
        support and have a smaller distribution.
      </p>
    </s1>
    <anchor id="jarFiles" />
    <s1 title="Jar File Dependency Graph">
      <p>The Batik Distribution comes with many Jar files.  Not all of
      them are needed in every case (although the provided
      applications tend to use most of them).  The following is a
      diagram showing the dependencies between the various jar files
      in the Batik binary distribution (it also shows the major
      package interdependencies for source developers).
      </p>
      <p>Jar files in white boxes are library jar files that Batik
      includes from external sources.  The light blue boxes correspond
      to library jar files (those found in the 'lib' directory of a
      binary distribution) built from Batik source code.  The dark
      blue boxes represent the application jar files.
      </p>
      <p>When boxes touch, the box on top depends on the box below it
      (there is no horizontal touching).  Arrows also indicate
      dependencies (the source of the arrow depends on the
      destination). In some cases a thick underline with an arrow is
      used to indicate that a large number of jar files share a common
      dependency, this however does not indicate any dependency
      between the jar files underlined.
      </p>
      <figure src="images/jarDependImg.png" 
        alt="Batik Jar File Dependency Graph" />
      <note>  Some jar file names are shortened for clarity.<br/>
        All 'batik' package references are short for
        'org.apache.batik'.<br/>
      </note>
      <p>It is worth pointing out that a determined/clever programmer
      may be able to pare down some of these dependencies.  For
      example the 'batik-dom.jar' depends on 'xerces.jar' because of
      the SAXDocumentFactory class in 'org.apache.batik.dom.util'.  If
      you didn't need to parse XML it would be possible to ignore or
      break this dependency and still use the 'batik-dom.jar' file for
      it's DOM implementation.
      </p>
    </s1>
    
    <anchor id="verify" />
    <s1 title="Verify Releases">
      <p>
        It is essential that you verify the integrity of the
        downloaded files using the PGP or MD5 signatures.
      </p>
      <p>
        The PGP signatures can be verified using PGP or GPG.  First
        download the <link
        href="http://www.apache.org/dist/xml/batik/KEYS">KEYS</link> as
        well as the <code>asc</code> signature file for the particular
        distribution you choose.  Make sure you get these files from
        the <link href="http://www.apache.org/dist/xml/batik/">main
        distribution directory</link> , rather than from a
        mirror. Then verify the signatures using
      </p>
      <p>
	<code>
          % pgpk -a KEYS <br/>
        % pgpv batik-1.5.zip.asc<br/>
      </code>
        <em>or</em><br/>
	<code>
          % pgp -ka KEYS<br/>
        % pgp batik-1.5.zip.asc<br/>
      </code>
        <em>or</em><br/>
	<code>
          % gpg --import KEYS<br/>
        % gpg --verify batik-1.5.zip.asc
      </code>
      </p>
      <p>
        Alternatively, you can verify the MD5 signature on the files.
        A UNIX program called <code>md5</code> or <code>md5sum</code>
        is included in many UNIX distributions.  It is also available
        as part of <link
          href="http://www.gnu.org/software/textutils/textutils.html">GNU
          Textutils</link> .  Windows users can get binary md5 programs
        from <link href="http://www.fourmilab.ch/md5/">here</link> ,
        <link
          href="http://www.pc-tools.net/win32/freeware/console/">here</link>
        , or <link href="http://www.slavasoft.com/fsum/">here</link> .
      </p>
      <p>
        We recommend using PGP signatures as they can provide a much
        higher level of assurance compared with MD5.
      </p>
    </s1>
  </body>
</document>
