Here are the steps that are required in order to build the JOGL
OpenGL binding from a fresh copy of the source distribution:
Install the JDK: the JOGL build requires JDK 1.4.2 or later. On AMD64 platforms such as Linux/AMD64, Solaris/AMD64 and Windows/AMD64, the build requires the Sun JDK 5.0 or later, as the 1.4.2 releases did not have an AMD64-specific JVM. On these platforms, it is also currently necessary to have e.g. bin/amd64/java in your PATH, although from a technical standpoint this could be worked around in the build process.
Install Ant: Download and unpack the latest version of Ant from http://ant.apache.org and add the bin/ subdirectory to your PATH environment variable.
Install ANTLR: Download and unpack the latest version of ANTLR from http://www.antlr.org. Only the jar file is needed.
Unset your CLASSPATH environment variable: The Ant build requires that the JOGL jars not be visible on the classpath. On Unix, type unsetenv CLASSPATH into a csh or tcsh shell, or unset CLASSPATH into a Bourne shell. On Windows, type set CLASSPATH= into a command prompt.
Check out the GlueGen source tree: JOGL relies on the GlueGen project to autogenerate most of the Java and JNI code for the OpenGL interface. The jogl/ and gluegen/ workspaces must be side-by-side in order for JOGL to build properly.
Copy and edit gluegen.properties:
Copy make/gluegen.properties from the GlueGen workspace into your home directory (pointed to by the Java system property user.home).
Edit the copy to change the location of the ANTLR jar file (typically $HOME/antlr-2.7.2/antlr.jar).
Copy and edit jogl.properties:
Copy make/jogl.properties into your home directory (pointed to by the Java system property user.home).
Edit the copy to change any settings that are necessary, in particular the setting of win32.c.compiler on Windows platforms (one of "vc6", "vc7", "vc8", "vc8_x64", or "mingw"). Note that on Windows 64-bit platforms the Professional edition of the Microsoft compilers is required.
The Windows build requires one of Microsoft Visual C++ 6, 7 (Visual Studio .NET), 8 (Microsoft Visual C++ 2005) or the free MinGW (http://www.mingw.org/) compilers to be installed. Choose the appropriate setting of win32.c.compiler for the compiler being used. The C compiler executable (cl.exe, gcc.exe) must be in your PATH; see below.
When building with VC6, VC7, or VC8, you must first run the vcvars32.bat environment variable setup script from the appropriate version of Visual C++. The Windows C compiler you choose in jogl.properties (i.e., win32.c.compiler=vc6) must match the version of the compiler from which you executed vcvars32.bat. No error checking is done on the compiler version used, so please be careful.
Build the source tree: Open a command shell in the "make" directory of the source tree and type "ant".
An experimental binding to the high-level Cg language by NVidia corporation can be generated by specifying -Djogl.cg=1 to ant; e.g. ant -Djogl.cg=1. The Cg binding has been tested on Windows, Linux, and Mac OS X.
Add JOGL to your CLASSPATH: To be able to use JOGL once built, you must add the build process' resulting jogl.jar (
Note that there are a lot of warnings produced by ANTLR about the
C grammar and our modifications to some of the signatures of the
productions; the C grammar warnings have been documented by the
author of the grammar as having been investigated completely and
harmless, and the warnings about our modifications are also
harmless.
Common build problems
Your CLASSPATH environment variable appears to be set (some JOGL classes are currently visible to the build.), and $CLASSPATH isn't set.
An older version of JOGL was installed into the extension directory of the JDK you're using to build the current JOGL. On Windows and Linux, delete any ANTLR jars from jre/lib/ext, and on Mac OS X, delete them from /Library/Java/Extensions. It is generally not a good idea to drop JOGL directly into the extensions directory, as this can interfere with upgrades via Java Web Start.
This occurs because ANTLR was dropped into the Extensions
directory of the JRE/JDK. On Windows and Linux, delete any ANTLR jars from jre/lib/ext, and on Mac OS X, delete them from /Library/Java/Extensions. Use the antlr.jar property in the build.xml to point to a JRE-external location of this jar file.
- Christopher Kline and Kenneth Russell, June 2003