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 code is 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.5.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 minimum 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 4.0 release, but it is known to work with 3.2 and 2.0.

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

  5. JInput - Java Input library for USB devices

    The 2.0 codebase has not been updated to support the latest Jinput. Its been removed from the compile list for now. You can download it here:

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

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

    make a directory c:/javaapis/joal download platform specific JOAL(Windows would be: to this directory unzip zip. These instructions assume you've installed this in c:/javaapis/joal

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

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

  8. SWT - Standard Widget Toolkit

    You'll need a 3.2 version of SWT.

    You can download it here:

    Assuming you downloaded

  9. Vecmath - Vector Math

    This comes in the Java3D distribution. I can't find a seperate download of the jar file.
    Its also available in Xj3D's CVS from src/eclipse/plugins/javax.vecmath_1.5.0.jar
    If you use this version you'll need to change VECMATH_CLASSPATH in the sample bashrc to point to this.

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.

We've created a sample bashrc for you. This includes all the setup information as specified in the above installs. Sample Bash rc You can either make this your .bashrc or "source sample_bashrc" in cygwin to use it.

Make sure the X3D_HOME and X3D_DOS_HOME are correct for your install. Non windows users will need to make some path changes for native libraries.

You will also need to change the JAVA_HOME environment variable. This should point to the location you installed java. So for JDK1.4.2_07 you would use:

export JAVA_HOME=c:/jdk1.4.2_07
Currently our build scripts do not support spaces in the JAVA_HOME. The default install for JDK5 is in C:/Program Files. You will have to move your JDK location to something like c:/jdk1.5 to use these build scripts.

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
    make config
    make properties
    make images
    make xml
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: 2008/05/16 18:00:08 $