Setting up JOGL Library for Eclipse EDI

In this billet I'll first show you how to setup JOGL library into Eclipse.

Notice that I used the Eclipse Juno version, you may have different menus, specially if you are using an older version.

Steps summary

  1. Downloading JOGL library
  2. Creating the JOGL Core user library under Eclipse
  3. Creating all the JOGL Native user library under Eclipse

Downloading JOGL library

JOGL Rubik's Cube project is based on JOGL 2, which you can find on Jogamp site. The download page is http://jogamp.org/deployment/jogamp-current/archive/.

Jogl2 download page

Download the files :

  1. jogamp-all-platforms.7z
  2. gluegen-javadoc.7z
  3. jogl-javadoc.7z

Notice that you will need the 7zip unarchiver program in order to extract them. The javadoc archives will help you when you'll use Jogl classes in Eclipse.

Creating the JOGL Core user library under Eclipse

First go into Windows->Preferences menu and type into the search box : User Libraries

![Eclipse User Libraries preferences]
(http://img11.hostingpics.net/pics/421530RubikCubeEDIWIKITuto1OverallPreferences.png "Eclipse User Libraries preferences")

Click on the "New..." button and define your JOGL_Core user library name, BUT SET THE "SYSTEM LIBRARY" OPTION OFF.

![Setting the library name]
(http://img15.hostingpics.net/pics/627281JOGLDansEclipse2.png "Setting the library name")

Your new library has just been created, but has no defintion :

![User library created but empty]
(http://img15.hostingpics.net/pics/388260JoglDansEclipse3.png "User library created but empty")

So,

Adding the jars to the JoglCore library
  1. Select it and click and the "Add External Jars..." button (on the right)
  2. Go into your uncompressed jogamp-all-platforms archive, and enter the jar subfolder
  3. Add the jar gluegen-rt.jar
  4. Do the same for the jogl-all.jar

So you see four categories in these jar entries.

![Gluegen and Jogl jars are added]
(http://img15.hostingpics.net/pics/558579JoglInEclipse4.png "Gluegen and Jogl jars are added")

We will only fill the nodes "Javadoc" and "Sources" for both nodes. Natives files are given as separates jars, so we won't need to set up the "natives" nodes.

Adding the javadocs to the JoglCore library

We will add the javadoc of the jars we've just added, so that Eclipse can tell us what are their classes and methods purposes.

I give you the procedure for the gluegen javadoc, but the procedure is similar for the jogl javadoc.

  1. Double click on the javadoc node of the Gluegen entry of your Jogl Core library. So you see a new dialog window : select the radio button "Javadoc URL" and click on the associated "Browse..." button : The two buttons in the new dialog window
  2. Go to your uncompressed gluegen-javadoc archive, and enter the "javadoc" directory, then press "Validate" button
  3. So you're back in the old dialog window. In order to be sure the path is good, you can press the "validate" button associated with the "Javadoc URL" radio button : you will be told if the path you have given seems to be a good path or not.
  4. Don't forget to validate this dialog window.
Adding the sources to the JoglCore library

This step is not necessary neither, i think but you'd better set it if you manage to. Anyway, I tell you how to set it. The procedure is the same for both jars.

  1. Double click on the source attachment node of the Gluegen jar (in your Jogl Core library). And in the new dialog window, select the "External location" radio button, then click on the "External file" button The two buttons in the new dialog window
  2. Go to your uncompressed jogamp-all-platforms archive and select the file gluegen-java-src.zip
  3. Don't forget to validate this dialog window.

Creating all the JOGL Native user library under Eclipse

We will start with the Windows_native_32bits user library, but the procedure is similar for other OS (Windows 64 bits, Linux 32, Linux 64, Solaris 32, Solaris 64, MacOsX universal). I'll just give you a table in order to know which file to use for which version.

Our first example
  1. Click on New.. button (on the right), and enter the new library name (Windows_Native_32)
  2. Go to the uncompressed archive of jogamp-all-platforms, and enter the jar subfolder.
  3. Add the jars, with the button "Add external jars ..." on the right, gluegen-rt-natives-windows-i586.jar and jogl-all-natives-windows-i586.jar
Natives libraries references

Here are all references :


Jogl_Natives_Windows_32

  1. gluegen-rt-natives-windows-i586.jar
  2. jogl-all-natives-windows-i586.jar

Jogl_Natives_Windows_64

  1. gluegen-rt-natives-windows-amd64.jar
  2. jogl-all-natives-windows-amd64.jar

Jogl_Natives_Linux_32

  1. gluegen-rt-natives-linux-i586.jar
  2. jogl-all-natives-linux-i586.jar

Jogl_Natives_Linux_64

  1. gluegen-rt-natives-linux-amd64.jar
  2. jogl-all-natives-linux-amd64.jar

Jogl_Natives_Solaris_32

  1. gluegen-rt-natives-solaris-i586.jar
  2. jogl-all-natives-solaris-i586.jar

Jogl_Natives_Solaris_64

  1. gluegen-rt-natives-solaris-amd64.jar
  2. jogl-all-natives-solaris-amd64.jar

Jogl_Natives_MacOsX

  1. gluegen-rt-natives-macosx-universal.jar
  2. jogl-all-natives-macosx-universal.jar

Conclusion

Now you should have your Jogl user libraries set up. In other billets I'll show you :

  1. How to use the Jogl Core and the Jogl Native (matching your os) in order to run the project
  2. How to export the project for the different OS.
 

Last edit: laurent bernabé 2013-08-18