Setting up JOGL Programming Enviornment
(on Windows as an example)

Jim X. Chen; August 2007

JOGL provides full access to the APIs in OpenGL specification as well as nearly all vendor extensions. To install and run JOGL, we need to install Java Development Kit. In addition, a Java IDE is also preferred to help coding. The following steps will guide you through installing Java, JOGL, and Eclipse, jGrasp, or JBuilder IDE.

Installing Java Development Kit

 

Java Development Kit (JDK) contains a compiler, interpreter, and debugger. If you have not installed JDK, it is freely available from Sun Microsystems. You can download the latest version from the download section at http://java.sun.com. Make sure you download the JDK Java SE (Standard Edition) not the JRE (runtime environment) that matches the platform you use. After downloading the JDK, you can run the installation executable file. During the installation, you will be asked the directory "Install to:". You need to know where it is installed. For example, you can put it under: "C:\myJDK\". In default, it is put under "C:\Program Files\Java\jdkxxx\".

Installing JOGL

 

We need to obtain the binaries in order to compile and run applications. Downlaod the current release build binaries that match the platform you use. After that, you can extract and put all these files (jar and dll files) in the same directory with the Java (JOGL) examples and compile all them on the command line in the current directory with:

"C:\myJDK\bin\javac"    -classpath jogl.jar *.java

After that, you can run the sample program with (the command in one line):


"C:myJDK\bin\java" -classpath .;jogl.jar;gluegen-rt.jar; -Djava.library.path=. J1_0_Point



That is, you need to place the "*.jar" files in the CLASSPATH of your build environment in order to be able to compile an application with JOGL and run, and place "*.dll" files in the directory listed in the "java.library.path" environment variable during execution. Java loads the native libraries (such as the dll files for Windows) from the directories listed in the "java.library.path" environment variable. For Windows, placing the dll files under "C:\WINDOWS\system32\" directory works. This approach gets you up running quickly without worrying about the "java.library.path" setting.


Installing a Java IDE (Eclipse, jGRASP, or JBuilder)


Installing a Java IDE (Integrated Development Environment) is strongly recommended. Without an IDE, you can edit Java program files using any text editor, compile and run Java programs using the commands we introduced above after downloading JOGL, but that would be very difficult and slow.
Java IDEs such as JBuilder, Eclipes, and jGRASP are development environments that make Java programming much faster and easier.

 

If you use Eclipse, you can put "*.jar" files under "Project->Properties->Libraries". You can download from http://eclipse.org the latest version of Eclipse that matches the platform you use. Expand it into the folder where you would like Eclipse to run from, (e.g., "C:\eclipse\"). There is no installation to run. To remove Eclipse you simply delete the directory, because Eclipse does not alter the system registry.


If you use jGRASP, in the project under "Settings->PATH/CLASSPATH->Workspace", you can add the directory of the *.dll files to the system PATH window, and add "*.jar" files with full path to the CLASSPATH window.

You can download a free version of JBuilder from http://www.borland.com/jbuilder/. JBuilder comes with its own JDK. If you use JBuilder as the IDE and want to use your downloaded JDK, you need to start JBuilder, go to "Tools->Configue JDKs", and click "Change" to change the "JDK home path:" to where you install your JDK. For example, "C:\myJDK\". Also, under "Tools->Configue JDKs", you can click "Add" to add "*.jar" files from wherever you save it to the JBuilder environment.


Creating a Sample Program in Eclipse


As an example, here we introduce using Eclipse. After downloading it, you can run it to start programming. Now in Eclipse you click on "File->New->Project" to create a new Java Project at a name you prefer. Then, you click on "File->New->Class" to create a new class with name: "J1_0_Point". After that, you can copy the following code into the space, and click on "Run->Run As->Java Application" to start compiling and running. You should see a window with a very tiny red pixel at the center. In the future, you can continue creating new classes, as we introduce each example as a new class. As an alternative, you can download the new examples from: joglExamples2007