Before installing XMLBeans, you will need to have JDK 1.8 installed and Ant. Once you have those, continue with the steps below.
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:
- 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:
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.
On Windows, do the following:
- Right-click My Computer, then click Properties.
- On the Advanced tab, click Environment Variables.
- 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.
- 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.
- 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.
- 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.
On UNIX/Linux, update your environment as follows:
- export XMLBEANS_HOME=<location of XMLBeans root>
- export PATH=$PATH:$XMLBEANS_HOME/bin
(or, if you built XMLBeans from source, export CLASSPATH=$XMLBEANS_HOME/build/lib/xbean.jar:$CLASSPATH)
- 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:
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.