apache > xmlbeans.apache.org

Installing XMLBeans


Before installing XMLBeans, you will need to have JDK 1.4 installed and Ant. Once you have those, continue with the steps below.

Download XMLBeans

To start out, you'll need the XMLBeans binaries. You can get these in one of two ways:

  • To get started more quickly, you can Download the XMLBeans release. For full XQuery and XPath support, be sure to download the Saxon XQuery processor as follows:
    • For XmlBeans 2.0.0 and XMLBeans 2.1.0 you need Saxon 8.1.1 ONLY.
    • For XmlBeans 2.2.0 you need Saxon 8.6.1 (may work with later revisions, but not tested)
  • If you're interested, you can also build from the source.

Set Environment Variables

After downloading and unzipping XMLBeans, you'll need to add environment variables that allow you to use the XMLBeans tools and binaries.

The following instructions assume you're using the XMLBeans release, whose directory structure looks like this:

    bin (location of tools)
    lib (location of xbean.jar)

If you're building from source, paths will differ slightly (note the location of xbean.jar). You should account for this when setting up your environment.

    bin (location of tools)
        lib (location of xbean.jar)

Windows Setup

On Windows, do the following:

  1. Right-click My Computer, then click Properties.
  2. On the Advanced tab, click Environment Variables.
  3. Add an XMLBEANS_HOME variable whose value is the XMLBeans location.

    For example, if you downloaded the XMLBeans release to the root of your C drive, this might be c:\xmlbeans-1.0.2.

  4. Edit the PATH variable so that it includes the bin directory of your XMLBeans installation. For the XMLBeans release, you could add %XMLBEANS_HOME%\bin.
  5. Edit the CLASSPATH variable to include the xbean.jar included with XMLBeans.

    This is located in the lib directory. If you built XMLBeans from source, you can also use the JAR file in the build/ar or build/lib directories.

  6. For XMLBeans V2, also include the jsr173_1.0_api.jar (or jsr173_api.jar, whichever one came in your download) to the CLASSPATH variable.

    This is found in the lib (or build/lib if you built XMLBeans from source) directory.

Note that you may also need to edit your PATH variable so that the JDK is earlier in the path. For more information, see the XMLBeans FAQ.

UNIX/Linux Setup

On UNIX/Linux, update your environment as follows:

  1. export XMLBEANS_HOME=<location of XMLBeans root>
  2. export PATH=$PATH:$XMLBEANS_HOME/bin
  3. export CLASSPATH=$XMLBEANS_HOME/lib/xbean.jar:$CLASSPATH

    (or, if you built XMLBeans from source, export CLASSPATH=$XMLBEANS_HOME/build/lib/xbean.jar:$CLASSPATH)

  4. For XMLBeans V2, export CLASSPATH=$CLASSPATH:$XMLBEANS_HOME/lib/jsr173[_1.0]_api.jar

    (or, if you built XMLBeans from source, export CLASSPATH=$CLASSPATH:$XMLBEANS_HOME/build/lib/jsr173[_1.0]_api.jar)

Your updates might look like this:

export XMLBEANS_HOME=/home/me/xmlbeans-2.1.0
export CLASSPATH=$XMLBEANS_HOME/lib/xbean.jar:$XMLBEANS_HOME/lib/jsr173_1.0_api.jar:$CLASSPATH

Once you've updated your environment paths, you should be set up to use the tools that come with XMLBeans. These include a schema compiler, an instance validator, and more.

To get started understanding and using XMLBeans, see Getting Started with XMLBeans.