Werner Guttmann werner DOT guttmann AT gmx DOT net

# Running the self-executable Castor JDO examples

As of release 1.0M3, the Castor JDO examples have been packaged in a new way and are available for download at the download page. In the following sections, we explain the steps required to unpack this new archive, and how to execute the tests.

## Download the castor-$RELEASE-examples.zip archive

In order to be able to run the new Castor JDO examples, please download the new `castor-`${RELEASE}`-examples.zip` from the download page and put it into some location on your computer.

## Unpack the ZIP file

To unpack the ZIP file downloaded, issue one of the following commands:

    unzip castor-1.1M2-examples.zip

or

    jar xvf castor-1.1M2-examples.zip

You can now run the examples using the directions provided in the next section.

## Running the Castor JDO samples

In the directory where you have unpacked the ZIP file you'll find a castor-1.1M2-examples.jar. In addition, you'll find a directory named `lib` where you'll find several JAR files required to run the samples.

To execute the samples, issue the following command:

    java -jar castor-1.1M2-examples.jar

... et voila ! You'll see various lines of logging output flashing by whilst the Castor JDO samples are executing against a database.

## What happens

The Castor JDO sample will test persistence between a set of Java classes (Product, ProductGroup, ProductDetail, etc.) and perform this code against an Apache Derby instance as RDBMS. For this purpose, the sample code will start an embedded Derby instance on the fly, create the required tables, and then continue to execute several code fragments using various Castor JDO artifacts (JDOManager, Database, etc.) against this embedded database.

In other words, everything is self-contained and there is no need to install a database, create a database schema, or create database tables. Everything required for the tests is initiated and set up from within the sample code.

## Hints

- If it is not set yet, you might have to set the `JAVA_HOME` environment variable, and add the $JAVA_HOME/bin directory to your path.