O'Reilly logo

Java & XML Data Binding by Brett McLaughlin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Installation and Setup

Getting Castor set up for use is just as simple as setting up Zeus; after a download and some classpath manipulation, you are ready to go. First, visit the Castor download site at http://castor.exolab.org/download.html, and download the Castor package. As of this writing, the latest version was 0.9.3.9, so the download file was called castor-0.9.3.9.tgz or castor-0.9.3.9.zip. Several other options for downloading are worth mentioning:

castor-0.9.3.9.jar

The Castor jar files without any tools or examples

castor-0.9.3.9-xml.jar

For use if you need only XML data binding, without any of Castor’s other mapping features

castor-0.9.3.9-doc.tgz

A complete set of Castor documentation, including relevant specifications; handy for reference purposes

Once you’ve got the archive, you’ll want to expand it into a working directory so you can access the samples and command-line tools. You’ll then need to add the Castor library to your classpath:

C:\dev\castor> set CLASSPATH=%CLASSPTH%;c:\dev\castor\castor-0.9.3.9.jar

Also make sure you have an XML parser in your classpath; I used xerces.jar in these examples. There are several other libraries in the Castor download, but you will not need any of them for XML data binding. However, if you plan to work with Castor’s Java Data Objects (JDO) capabilities (see the end of this chapter for more details), then you will also need to add jdbc-se2.0.jar and jta1.0.1.jar to your classpath.

Additionally, you will want to download ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required