Setting up JOGL, class examples, and your working environment For
your working environment
the example code
JOGL project website (located at https://jogl.dev.java.net/
) hosts both the JOGL library itself, as well as the native libraries for
several platforms that the JOGL library requires.
The jogl library is a .jar file (much the same format as a unix .tar
file, with extended rules to allow java to run a jar file without extracting
its contents), and the latest version (at the time of this writing) can
be downloaded here:
requires several native libraries to function.
These libraries can be downloaded here:
JOGL javadoc documentation can be viewed online here:
downloaded as a zip archive here:
provides a collection of demo applications to test whether your JOGL instillation
and working environment are correct:
your working environment
OS X: Place both the "jogl.jar" file and the following .jnilib files in
your java system libarary directory (/System/Library/Java/Extensions/):
Following the instructions located here: (http://today.java.net/pub/a/today/2003/09/11/jogl2d.html)
install your "jogl.jar" file inside the lib/ext directory located in the
home directory of the java install (Search for the java binary if you can't
find the java home directory), and install the following native libraries
under the jre/bin directory:
The "jogl.jar" file can be placed in any directory, although it is recommended
to keep all your ".jar" files in one directory.
The library ".so" files should be placed together in one directory.
The directory "/usr/local/lib/jogl/" is suggested, although you could
create it anywhere your normal user account will have read access.
The following files should be placed in this directory:
the example code.
order to compile and run java code written to use the JOGL library you must
configure two environment variables.
Windows and Mac OS X systems, installing the native libraries and the "jogl.jar"
file in the appropriate directories should cause the system to automatically
configure these settings properly (IE you can skip to step 4 if you are
able to compile and run JOGL applications after completing step 2).
However, if you are unable to compile and run any of the JOGL demos
provided at the JOGL home page, try to configure your environment variables
as described below.
users should read the following on how to use and set environment variables:
Unix based operating systems like Linux and Mac OS X you can set environment
variables on the command line in the following way:
the bash shell (standard on osf1): export VARIABLE=value example:
third example uses the previous value in the CLASSPATH variable as part
of the new value. When
a dollar sign is placed before a variable name it is "dereferenced" and
the value stored in that variable is used instead of the variable itself.
If CLASSPATH had been empty before the second example, and examples
2 and 3 occurred one right after the other, the value stored in the CLASSPATH
variable would be /System/Library/Frameworks/JavaVM.framework/Classes/classes.jar
a variable in this way only sets that variable for the current shell session,
meaning that if you open a new shell (new window if you're using xterm
or apples Terminal.app), the variable will be the same as it was before
you issued the export command.
To set this variable every time you should place the export command
inside your shell's rc file or in your .profile file (the bash rc file
is located in your home directory under the name .bashrc).
CLASSPATH environment variable should be set to include the jogl.jar file.
Make sure you include the full path to the jogl.jar file, including
just the directory above the jogl.jar file is not enough:
<- Won't work!
Linux, creating the /usr/local/lib/jogl directory and adding the native
libraries to it is not sufficient to let java know where those libraries
are. When running
a JOGL application you must specify a list of directories where java looks
for library binaries, similar to the CLASSPATH environment variable except
that this is a setting specific to java and is set through a java property
on the command line. If
you placed your .so files in the directory "/usr/local/lib/jogl" you should
use the following argument with java:
the provided code (available here: http://www.cs.gmu.edu/%7Ejchen/graphics/jogl/notes/src.zip
) is compatible with 2003-2005 release builds.
In order to make the code compatible with the newer releases of JOGL
several non-backwards compatible backwards changes had to be made to the
code. These changes are
included in a patch available here:
apply the patch on a unix based computer, use the command line utility called
"patch". If you are using
a windows machine, copy the example files on to your osf1 account, follow
the instructions below and copy the modified files back.
cs652patches.zip // by Jim X. Chen
- Unzip the contents of the "src.zip" file, and rename the directory "cs652-examples".
This is important, as the patch utility will look for a directory
with this name to apply the patches to.
- mv cs652-examples cs652patches // by Jim X. Chen
apply the patch in the following way
cs652patches //by Jim X. Chen
- patch -p0 < cs652-examples.patch2 // by Jim X. Chen
- patch -p0 < cs652-examples.patch1
the above command fails for some reason, you can still apply the patches
individually. The individual
patch files are all found within the "patches" directory inside the cs652patches
directory. The are named
according to the name of the file that they are applied to: <filename>.patch<N>.
<filename> is the name of the old file, and N is some integer
representing the version of the patch.
If newer patches are released, they will have higher version numbers.
An example of applying an individual
patch to the file "J1_0_Point.java":
the future, a zip of the modified files may be provided in which case you
will not need to download or apply the patches.