Xaj: Building from source

This guide explains how to compile the Xaj binary JAR from source.

At a minimum you'll need the following tools to be able to build Xaj:

Java 5 JDK
The Java 5 JDK is required for compiling the sources.
Apache Ant
Ant is available at http://ant.apache.org/.

To build individual XmlDb back-end implementations, you'll need additional JARs, detailed in the build instructions for each implementation in this document.

Get source files

The Xaj source files are stored in a Subversion repository, hosted on SourceForge.net. You'll need a Subversion client to check out the sources.

The main development trunk is available at this URL:


Specific releases are available at URLs like the following:


Substitute the release name you're interested in for RELEASE (e.g. 1.0).

For example, to get the latest sources checked out into a directory named xaj on your computer, you could do this (using the svn command line tool):

~matt $ svn co https://xaj.svn.sourceforge.net/svnroot/xaj/xaj xaj A /home/matt/xaj/src-sedna A /home/matt/xaj/src-sedna/net A /home/matt/xaj/src-sedna/net/sf A /home/matt/xaj/src-sedna/net/sf/xaj A /home/matt/xaj/src-sedna/net/sf/xaj/sedna A /home/matt/xaj/src-sedna/net/sf/xaj/sedna/SednaXmlDb.java A /home/matt/xaj/src-sedna/net/sf/xaj/sedna/SessionHolder.java ...

Core build

Xaj is split between the core framework packages and individual back-end implementation packages. The core framewwork consists of:

Core API
The main API interfaces in the net.sf.xaj package.
Core supporting implementation
Supporting implementation classes, used by other back-end implementation packages. These are in the net.sf.xaj.core package.
Core web-based remote implementation
The core framework includes a web-based remote API implementation, which consists of both the client implementation classes and server implementation classes. These are in the net.sf.xaj.web package.

To build just these core packages, run the jar Ant task.

~matt $ ant jar Buildfile: build.xml prepare.compile: [mkdir] Created dir: /home/matt/ws-lms/xaj/build/ant/bin [mkdir] Created dir: /home/matt/ws-lms/xaj/build/ant/src compile.core: [javac] Compiling 32 source files to /home/matt/ws-lms/xaj/build/ant/bin [copy] Copying 32 files to /home/matt/ws-lms/xaj/build/ant/src ... jar: [jar] Building jar: /home/matt/ws-lms/xaj/dist/xaj.jar BUILD SUCCESSFUL

This will create the dist/xaj.jar JAR file that contains both the compiled Java sources as well as the original source files.

Building non-core implementation packages

To build actual Xaj backend implementations, you'll need supporting JARs made available by each implementation's release packages. Xaj supports many different implementations, some of which are open source and some which are not.

For any non-core package you want to build, you'll need to copy the JAR files listed here into the environment/local directory of your checked-out Xaj project. Then you simply run the jar Ant task, passing a command-line build property -Dwith.package=true to add that package to the built JAR.

Berkeley DB XML

You need to copy the db.jar and dbxml.jar files from your Berkeley DB XML distribution into environment/local. Then run the jar task, passing -Dwith.bdb=true:

~matt$ ant -Dwith.bdb=true jar Buildfile: build.xml ... compile.bdb: [javac] Compiling 9 source files to /home/matt/ws-lms/xaj/build/ant/bin [copy] Copying 9 files to /home/matt/ws-lms/xaj/build/ant/src ... jar: [jar] Building jar: /home/matt/ws-lms/xaj/dist/xaj.jar BUILD SUCCESSFUL


Copy the following JARs from your Exist distribution into environment/local:

  1. exist-modules.jar
  2. exist-optional.jar
  3. exist.jar
  4. xmldb.jar
  5. xmlrpc-1.2-patched.jar

Then run the jar task, passing -Dwith.exist=true:

~matt $ ant -Dwith.exist=true jar Buildfile: build.xml ... compile.exist: [javac] Compiling 5 source files to /home/matt/ws-lms/xaj/build/ant/bin [copy] Copying 5 files to /home/matt/ws-lms/xaj/build/ant/src ... compile: jar: [jar] Building jar: /home/matt/ws-lms/xaj/dist/xaj.jar BUILD SUCCESSFUL

Building Xaj web server

Xaj can be deployed into a J2EE servlet container as a WAR, which is useful for XML DB implementations that do not run as a network server natively (such as Berkeley DB XML).

Xaj also provides a web-remote implementation wrapper so you can use the remote web server as if it were a normal local instance.

To build the Xaj WAR, do the following:

  1. Create server configuration context file(s) and copy them into environment/local. See the defs/examples directory for example context files for the backend you are interested in.
  2. Create log4j.properties and ehcache.xml configuration as needed in environment/local. See the defs/examples directory for examples.
  3. Run the dist-war Ant task (be sure to specify your non-core implementation flags still) to build the xaj.war file.
  4. Deploy the WAR file into your favorite servlet container.

Once running, you should be able to visit the /xaj/admin/xquery.do URL in your browser to use the XQuery Admin Tool to execute queries.

SourceForge.net Logo