Setting up a JogAmp project in your favorite IDE
It's very simple to set up an Eclipse project to use JOGL. These instructions assume you've already created a new project in Eclipse and want to add the JOGL libraries to it.
Download JOGL
You can get the files for the latest stable version at https://jogamp.org/deployment/webstart/. You'll need to download eight things, shown below. Pick the "natives" JARs appropriate to your platform; we show 64-bit Windows versions in the examples below.
- gluegen-rt.jar (downloads as gluegen-rt.gz)
- gluegen-rt-natives-windows-amd64.jar
- jogl.all.jar (downloads as jogl.all.gz)
- jogl-natives-windows-amd64.jar
- nativewindow.all.jar (downloads as nativewindow.all.gz)
- nativewindow-natives-windows-amd64.jar
- newt.all.jar (downloads as newt.all.gz)
- newt-natives-windows-amd64.jar
Or if you want the latest automatic build, you can download it as one big file from https://jogamp.org/deployment/autobuilds/master/. Pick the most recent jogl-b* directory, then download the right zip file for your platform from it. For 64-bit Windows the file will be jogl-2.0-bvvv-2010mmdd-windows-amd64.zip.
Unzip or unjar all the files you downloaded, then pull out gluegen-rt.jar, jogl.all.jar, nativewindow.all.jar newt.all.jar, and all the .dll or .so files. These files form your JOGL installation, which you can put wherever you want.
This installation contains all of JOGL. If you want to trim it down, see https://jogamp.org/jogl/doc/deployment/JOGL-DEPLOYMENT.html for more information.
Create a JOGL user library
You can make your new Eclipse project depend directly on all the JOGL JARs and native libraries, but it's inconvenient to do that every time you create a new project. Creating a user library bundles all the JOGL files together so you can include them in one step.
- Click "Window > Preferences", then select "Java > Build Path > User Libraries" on the left.
- Click the "New..." button, type "JOGL" for the library name, and click "OK".
- Click the "Add JARs..." button, navigate to the directory where you've stored the JOGL JARs, select gluegen-rt.jar, jogl.all.jar, nativewindow.all.jar and newt.all.jar, then click "Open".
- For each of these four JARs, expand it in the list, double-click "Native library location", type the directory where the JOGL .dll or .so files are stored, and click "OK".
- Click "OK" to exit Preferences dialog.
Add JOGL to your project's dependencies
- Right-click your project in the Package Explorer and clock "Properties".
- Select "Java Build Path" and click the "Libraries" tab.
- Click "Add Library...", select "User Library", click "Next", check "JOGL", and click "Finish".
- Click "OK" to dismiss the Properties dialog.
That's it! You can now use JOGL in your project.