How To Install and Compile Xj3D

Required Libs | PATH/CLASSPATH | Building Xj3D |

What is Xj3D?

Xj3D is an example Open Source implementation for the X3D and VRML97 specifications.

This page is intended to help software developers examine and contribute to the source code. This is beta source code under active development. If you are just interested in using the codebase you do not need this document! We have a user install available here. This install includes everything you need to use Xj3D as a Java3D loader and includes a sample VRML97/X3D Browser.

Setting up your Windows PC to compile the Xj3D Source

This section will take you through the steps needed to setup your system to compile Xj3D. It will help you locate all the required utilities/libraries and detail which versions have been tested to work. This version will provide a checklist view.

Install the packages to whatever directories you like, but record their locations. We recommend a directory location that will be used in example paths. You will use these locations later to setup your CLASSPATH and PATH environment variables. If a package is mentioned as residing in the lib directory then we suggest you use that version. Some of these are hard to find, tracking at a different version or we have modified them.

  1. Cygwin: Obtain a UNIX box, or turn your PC into a UNIX box via: GNU Utilities for PCs are available at
    Provides Unix command line and utilities on Windows 95/98/NT/2000/XP.


  2. CVS is the Concurrent Versioning System, which is widely used for software management projects shared among multiple individuals.

    CVS is included in the Cygwin distribution. The next steps will take you through downloading the Xj3D code. At this point you have a decision to make. You can either download the latest stable release or jump into the raw development stream. I'd recommend going for the latest stable release, you've got enough to do for now without worring about our untested changes!

    Checking out the Code:

    Troubleshooting CVS:

  3. Java2 SDK is available at

    We have successfully used the latest 1.4.x series as well. We develop against the latest version of the JDK but maintain compatibility against the previous version as well as the current one. So, for example, when JDK 1.6 comes out, we will drop 1.4 support and require a minumum of 1.5.

  4. JavaCC has had many homes over the years. It now appears to be a project under the Java.Net community process. You can download the latest version from We compile against 3.2 release, but it is known to work with 2.0.

    Note: When installing make sure you select the UNIX shell scripts version of scripts

  5. Rhino is a ECMAScript/JavaScript interpreter. It is needed for the ECMAScript code in the Script node. You can download it from: We have tested the code with Rhino 1.5R2, and currently work with 1.5R4_1. We recommend installing this api into the directory c:/javaapis/rhino1_5R4_1 Note that from 1.5R4, something fairly major changed internally about how it handles global function definitions. We're not sure why this is, but it broke the ability to support the print() and println() methods that some browsers use for VRML97 scripting. For us, use Browser.println().

  6. JInput - Java Input library for USB devices You can download it here:

    These instructions assume you've installed this in c:/javaapis/jinput

  7. JOAL - Java Open AL Bindings You can download it here:

    These instructions assume you've installed this in c:/javaapis/joal

  8. JMF - Java Media Framework provides video libraries. You can download it here:

    The JMF installer will place the files where they are needed.

Xj3D currently supports three renderers. Each one uses a different underlying rendering library. You will need to install at least one of these renderers.

Environment Variable Setup

PATH and CLASSPATH settings are always a bit tricky. The easiest way to setup the system environment variables is to modify the .bashrc file located in c:/cygwin/home/$userid. Where $userid is your system userid.

All the examples here assume you have installed the Xj3D codebase into "c:/xj3d". Modify these as needed for your local setup.

Here are the paths you will need. All locations assume the default install directories specified above. Replace for semi-colons with colons for real unix machines.

   export PATH="c:/jdk1.4.2_06/bin;c:/javacc3.2/bin;$PATH"
   export CLASSPATH="c:/xj3d/Xj3D;c:/xj3d/Xj3D/classes;c:/xj3d/Xj3D/lib/j3d-org.jar;C:/Program Files/JMF2.1.1/lib/jmf.jar;c:/xj3d/Xj3D/lib/aviatrix3d-all.jar;c:/xj3d/Xj3D/lib/vlc_uri.jar;c:/xj3d/Xj3D/lib/uri.jar;c:/xj3d/Xj3D/lib/opengis.jar;c:/xj3d/Xj3D/lib/units-0.01.jar;c:/xj3d/Xj3D/lib/gt2-main.jar;c:/xj3d/Xj3D/lib/odejava.jar;c:/xj3d/Xj3D/apps/browser/classes;C:/javaapis/jinput/coreAPI/lib/jutils.jar;C:/javaapis/jinput/plugins/DX8/lib/jinput.jar;C:/javaapis/jinput/plugins/DX8/bin/dxinput.jar;c:/xj3d/Xj3D/lib/dis.jar;c:/javaapis/rhino1_5R4_1/js.jar;c:/xj3d/Xj3D/lib/dtdparser113a.jar;c:/xj3d/Xj3D/lib/gnu_regexp-1.0.8.jar;c:/xj3d/Xj3D/lib/httpclient.jar;c:/xj3d/Xj3D/lib/j3d-org-images.jar"
   export PROJECT_CLASSPATH="c:/javaapis/rhino1_5R4_1/js.jar"

The final step in the setup is to ready your personal environment so that our build scripts work. Building is provided using Make. For make to work correctly you will need to set the PROJECT_ROOT environment variable. This points to the directory that you downloaded CVS into. For example, if you put the CVS code into c:/Xj3D/x3d, then you will need the following (including quotes):
   export PROJECT_ROOT="c:/xj3d/Xj3D"
Note that this all assumes you are running in the cygwin environment. All the slashes are unix style, yet we need to put DOS style directories. If you are running on a unix machine, then put your normal unix style path here eg:
   export PROJECT_ROOT=/home/username/xj3d/Xj3D
You will also need to set the JAVA_HOME environment variable. This should point to the location you installed java. So for JDK1.4.2_06 you would use:
export JAVA_HOME=c:/jdk1.4.2_06

Building the Xj3D source

Copy the file Makefile from the make directory into this directory.
    cp make/Makefile .
Now, to compile the code, simply change to this xj3d directory and type:
    make parsers
This will build all of the parser source code using javacc

If you are using the default JOGL renderer type:

    make ogl

If you are using the Java3D renderer type:

    make j3d

If you are using the Mobile renderer type:

    make mobile
The make system provides a number of other options. These are listed below:

Typing just

Will provide a complete list of options available, including those for compiling a code for only a specific renderer.

To test that you have the codebase compiling correctly try the following:

    cd examples/browser
    java OGLBrowser
    in location append "..\..\parsetest\events\moving_box.wrl"
    hit the Go! button
    see box, rejoice!

Last Revised: $Date: 2005-10-12 17:19:27 $