# Howto: How to compile JOnAS

The content of this guide is the following:

1. Target Audience and Rationale
2. Getting the JOnAS Source
3. Recompiling JOnAS from the Source
4. Recompiling the package JOnAS/Jetty/Axis from the Source
5. Recompiling the package JOnAS/Tomcat/Axis from the Source

## Target Audience and Rationale

The target audience for this chapter is the JOnAS user who wants to build a JOnAS version from the source code obtained from CVS.

## Getting the JOnAS Source

CVS (Concurrent Version System) provides network-transparent source control for groups of developers. It runs on most UNIX systems and on Windows NT systems. Refer to http://www.cyclic.com for more information

CVS provides many read-only cvs commands, such as `cvs status` or `cvs diff`. However, because it is read only, an individual user cannot commit changes. To start working with CVS on JOnAS, make a `checkout` of the `jonas` module, using the following command:

        cvs -d :pserver:anonymous@cvs.jonas.forge.objectweb.org:/JOnAS login
        (hit enter key when prompted for password)
        cvs -d :pserver:anonymous@cvs.jonas.forge.objectweb.org:/JOnAS co jonas

The `CVSROOT` variable can be set, instead of using the -d option.

## Recompiling JOnAS from the Source

1. Download Ant from the Ant project site.

   The `build.xml` file used for building JOnAS is located in the `objectweb/jonas` directory.

2. The JDK and ANT must have been successfully configured. (`JAVA_HOME, ANT_HOME, PATH` environment variables)
3. Set the following environment variables with the appropriate value:
   - JONAS_ROOT: mandatory
   - CATALINA_HOME: optional (mandatory for using the web container Tomcat)
   - JETTY_HOME: optional (mandatory for using the web container Jetty)
4. Perform the following:

   `cd $OBJECTWEB_HOME/jonas` and choose a target:

   - `ant install` to install a JOnAS binary distribution version in the `JONAS_ROOT` directory.
   - `ant all` to build JOnAS and keep the files in the `output` directory.
   - `ant archive` to build a JOnAS archive (.tgz extension) that contains a binary version of JOnAS. The archive is built in the `HOME` directory.

## Recompiling the package JOnAS/Jetty/Axis from the Source

1. Download Ant from the Ant project site.

   The `build.xml` file used for building JOnAS is located in the `objectweb/jonas` directory.

2. Place the bcel.jar in the `ANT_HOME/lib` directory. It is available for downloading from the Jakarta web site.
3. The JDK and ANT must have been successfully configured. (`JAVA_HOME, ANT_HOME, PATH` environment variables)
4. Set the following environment variables with the appropriate value:
   - JONAS_ROOT: mandatory
   - JETTY_HOME: mandatory
5. Perform the following:

   `cd $OBJECTWEB_HOME/jonas` and choose a target:

   - `ant install_jetty` to install a JOnAS/Jetty/Axis binary distribution version into your `JONAS_ROOT` directory.
   - `ant all_jetty` to build JOnAS/Jetty/Axis and keep the files in the `output` directory.
   - `ant archive_jetty` to build a JOnAS/Jetty/Axis archive (.tgz extension) that contains a binary version of JOnAS/Jetty/Axis. The archive is built into the `HOME` directory.

## Recompiling the package JOnAS/Tomcat/Axis from the Source

1. Download Ant from the Ant project site.

   The `build.xml` file used for building JOnAS is located in the `objectweb/jonas` directory.

2. Place the bcel.jar in the `ANT_HOME/lib` directory. It is available for downloading from the Jakarta web site.
3. The JDK and ANT must have been successfully configured. (`JAVA_HOME, ANT_HOME, PATH` environment variables)
4. Set the following environment variables with the appropriate value:
   - JONAS_ROOT: mandatory
   - CATALINA_HOME: mandatory
5. Perform the following:

   `cd $OBJECTWEB_HOME/jonas` and choose a target:

   - `ant install_tomcat` to install a JOnAS/Tomcat/Axis binary distribution version into the `JONAS_ROOT` directory.
   - `ant all_tomcat` to build JOnAS/Tomcat/Axis and keep the files in the `output` directory.
   - `ant archive_tomcat` to build a JOnAs/Tomcat/Axis archive (.tgz extension) that contains a binary version of JOnAS/Tomcat/Axis. The archive is built in the `HOME` directory.