This document explains how to download and install ObjectBox, the free o:XML compiler and interpreter. It also shows how to compile and run o:XML programs from the command line, and where to find example code.


Install Java

First, make sure you've got at least Java v1.4. Java is available to download for free from ibm.com or java.sun.com. The ObjectBox works with either the Software Development Kit (SDK) Standard Edition or Enterprise Edition, or the Java Runtime Environment (JRE).

There are also open-source alternatives such as Kaffe - see this GNU page for more information.

To install Java, simply follow the instructions that come with your choice of Java implementation.

To verify that Java is working correctly, open a terminal window or DOS prompt and type this at the command line:

java -version

You should see something similar to this:

java version "1.4.2_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_01-107)
Java HotSpot(TM) Client VM (build 1.4.2-001-31, mixed mode)

If you get a message saying command not found, in spite of having installed Java correctly, you need to set your PATH environment variable to include the Java command directory.

Download the ObjectBox

Next you need to download a single file, objectbox.jar, which contains everything you need to run the compiler and interpreter from the commandline.

That's it! You now have everything you need to compile and run o:XML programs.

Running Programs

To start the ObjectBox you need to open a command or terminal window (or DOS prompt) and issue this command:

java -jar objectbox.jar

This assumes that the downloaded file objectbox.jar is in the current directory.

Without specifying a program file, the command will simply print out usage instructions. For example you might see:

ObjectBox version 1.1.0
usage: java org.oXML.engine.ObjectBox [options...] file
        -Dname                  set program parameter 'name' to true
        -Dname=value            set program parameter 'name' to 'value'
        -Sname                  set session parameter 'name' to true
        -Sname=value            set session parameter 'name' to 'value'
        -S                      create an empty program session
        -encoding charset       set output character encoding to 'charset'
        -noext                  do not load default language extensions
        -e classname            use language extension 'classname'
        -xsl                    post-process with XSLT engine
        -v                      be verbose
        -q                      be quiet
        -help (or -h)           print instructions and exit
        -version                print version details and exit

You can compile and run an o:XML program with the following command:

java -jar objectbox.jar example-1.oml

This assumes that both objectbox.jar and the program itself, example-1.oml, are in the current directory.

Without options, the ObjectBox will compile and run the program and print the result to the screen.

For information about command line options see the ObjectBox Usage Instructions.

Example Programs

There are examples from the Programming Guide available on the o:XML download page.

You can also download a zip file with examples from the article Introducing o:XML, published on the O'Reilly website XML.com