This getting started-tutorial is intended for JOGL users that are mere beginners. It helps to setup a recent JOGL installation in Eclipse on Windows. There is a video-walk-through further down the post, in case you dont feel like reading.

First you need to download JOGL. This is actually more difficult than it sounds because the precompiled binary packages are a bit hidden in the new project site. Fortunately, I figured out where you can download recent JOGL binaries.

For this tutorial, I am using

  • jogl-b633-2012-01-23_20-37-13, and
  • gluegen-b480-2012-01-23_16-49-04.

This is how your project setup should look like:

JOGL Project Setup

So one you got the binaries, unpack the ZIP file somewhere. You will notice the jar folder with a number of JAR files. All you need is in that jar folder, because the DLL binaries are included in the JARs.

Create a new eclipse project (name doesnt matter) and add the following JARs on the classpath:

  • gluegen-rt-natives-windows-amd64.jar
  • gluegen-rt.jar
  • jogl-all-natives-windows-amd64.jar
  • gluegen-rt.jar

These files are the native part of the OpenGL binding and are linked via Java Native Interface (JNI). Since the DLLs are precompiled as part of the JAR files, you are almost ready to go.

Once you got that set up, create a package de.schabby.jogl.helloworld and copypaste the following two classes in the newly created package.

package de.schabby.jogl.helloworld;

import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.JFrame;

public class HelloWorld 
    public static void main(String[] args) 
    	// setup OpenGL Version 2
    	GLProfile profile = GLProfile.get(GLProfile.GL2);
    	GLCapabilities capabilities = new GLCapabilities(profile);
    	// The canvas is the widget that's drawn in the JFrame
    	GLCanvas glcanvas = new GLCanvas(capabilities);
    	glcanvas.addGLEventListener(new Renderer());
    	glcanvas.setSize( 300, 300 );

        JFrame frame = new JFrame( "Hello World" );
        frame.getContentPane().add( glcanvas);

        // shutdown the program on windows close event
        frame.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent ev) {
        frame.setSize( frame.getContentPane().getPreferredSize() );
        frame.setVisible( true );

The class looks like follows. It implements GLEventListener which is the call-back implementaiton by JOGL to do all OpenGL rendering.

package de.schabby.jogl.helloworld;


class Renderer implements GLEventListener 
    private GLU glu = new GLU();

    public void display(GLAutoDrawable gLDrawable) 
        final GL2 gl = gLDrawable.getGL().getGL2();
        gl.glTranslatef(-1.5f, 0.0f, -6.0f);
        gl.glVertex3f(0.0f, 1.0f, 0.0f);	
        gl.glVertex3f(-1.0f, -1.0f, 0.0f);	
        gl.glVertex3f(1.0f, -1.0f, 0.0f);	
        gl.glTranslatef(3.0f, 0.0f, 0.0f);
        gl.glVertex3f(-1.0f, 1.0f, 0.0f);	
        gl.glVertex3f(1.0f, 1.0f, 0.0f);	
        gl.glVertex3f(1.0f, -1.0f, 0.0f);	
        gl.glVertex3f(-1.0f, -1.0f, 0.0f);	

    public void displayChanged(GLAutoDrawable gLDrawable, boolean modeChanged, boolean deviceChanged) 
    	System.out.println("displayChanged called");

    public void init(GLAutoDrawable gLDrawable) 
    	System.out.println("init() called");
        GL2 gl = gLDrawable.getGL().getGL2();
        gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);

    public void reshape(GLAutoDrawable gLDrawable, int x, int y, int width, int height) 
    	System.out.println("reshape() called: x = "+x+", y = "+y+", width = "+width+", height = "+height);
        final GL2 gl = gLDrawable.getGL().getGL2();

        if (height <= 0) // avoid a divide by zero error!
            height = 1;
        final float h = (float) width / (float) height;
        gl.glViewport(0, 0, width, height);
        glu.gluPerspective(45.0f, h, 1.0, 20.0);

	public void dispose(GLAutoDrawable arg0) 
		System.out.println("dispose() called");

By right-clicking on the main() method and chosing "run as application", Eclipse will execute the program. You should see something like this:

Jogle Hello World

For the lazy, I provide a video-walkthough.

Common problems and solutions:

  • If you get Can't load AMD 64-bit .dll on a IA 32-bit platform, then you are using an 64bit DLL (eg. gluegen-rt.dee) with an JRE that is 32bit. In most cases you can just switch to a 64bit JRE if you are running a 64bit system. Make sure that Eclipse is using the right JRE when you execute the code.
  • If you get no gluegen-rt in java.library.path, then you may need to add gluegen-rt-natives-windows-amd64.jar to you classpath.
  • If you get no nativewindow_awt in java.library.path, then you may need to add jogl-all-natives-windows-amd64.jar to you classpath.

That's it so far. Please let me know if you have questions or comments.

Categories: JavaOpenGL


wdaogang · August 12, 2010 at 1:52 pm

thanks a lot .非常谢谢

Junior · August 19, 2010 at 11:44 am

Hi are the import; standand jogl imports or are they showing its from the internet

    schabby · August 19, 2010 at 11:47 am

    There is a JSR on OpenGL/JoGL so I guess it made its way into the giant library by now, but I usually pick the most current binaries from the Jogle project site. You find the URL on my previous post:

    I hope this answers your question? 🙂

luis · November 21, 2010 at 7:27 am

I am having linker errors ( I have a 64bit windows 7 os, but both JVM and eclipse are 32bit so I am using JOGL 32 bit too) for some reason it says that it can’t link the native windows 32 I placed all four dlls in the class path. here is a pic of the error

luis · November 23, 2010 at 7:59 pm

Found how to run the program after days of surfing the net.

ok, I will explain how I managed to run it and set up JOGL at the same time. shows how to create your own user library; once this is done I had some trouble running the dlls which I fixed by placing them in the directory of the project I was working on.

Julien Gouesse · January 5, 2011 at 10:18 pm

Your example is wrong, you should never have “height” set to zero. If it happens, it means that the height of your canvas is 0. Moreover, your example won’t work with the debug pipeline of JOGL 2.0, a GLException will be thrown very early.

schabby · January 6, 2011 at 10:24 am

Hi Julien, thanks for your post! I will correct my example as soon as i get the chance.

Best Regards!


Shura · March 30, 2011 at 7:44 pm

Thanks – I’ve tried setting up JOGL so many times, and this is the only way that has worked!

    schabby · March 31, 2011 at 9:19 am

    Hi Shura, cool, I am glad it helped 🙂


testpilot · April 30, 2011 at 1:36 pm

Instead of adding a WindowListener for exiting the application, consider using


as a shortcut instead.

slash13 · July 11, 2011 at 7:50 pm

AWESOME tutorial, for me was really hard to find a decent one.
Thanks a lot

mercutio · August 8, 2011 at 8:11 pm


By chance, do you also have an example how to run a jogl program as a java applet ?


    schabby · August 8, 2011 at 8:32 pm


    I am afraid I dont 🙁 I never really put too much though in applets to be honest. WebGL is about to win the openGL-in-Browsers race from my point of view.

Yogesh · December 31, 2011 at 4:47 am

Thanks for the post., it helped me a lot., but i faced a problem while adding a jar file in eclipse. You have mentioned about adding the following jar files.,
1. jogl.all.jar
2. nativewindow.all.jar
3. gluegen-rt.jar
I could not find them on my computer, I downloaded the latest zip file from the link you have provided in your post.,
I have downloaded the file named “jogl-2.0-b610-20111226-windows-i586.7z” under the link ” jogl-b610-2011-12-26_00-30-55″ dated 26-12-2011. unzipped the file., but i could not find all the jar files mentioned above. I could just find “jogl.all.jar”. Hope you’ll help me with this.


Johannes · January 27, 2012 at 8:05 pm

If you get the error

“Can’t load IA 32-bit .dll on a AMD 64-bit platform”

you downladed the 32-bit binaries, not the 64bit binaries.

mrtipper · March 14, 2012 at 4:05 am

I tried the hello world tutorial and it will work when I run it from eclipse, however when i close the window (click the x) it still leaves and instance of javaw.exe running in the task manager. I have to manually end the process all the time. Any ideas whats causing this?

    schabby · March 14, 2012 at 11:38 am

    Hi, the window is independent from the OS process. So closing the window does not terminate the VM. I will enhance the example to shut down the VM once the user closes the window.

    Thanks for pointing me at this!!


Vishu · March 22, 2012 at 6:12 pm

Hi, thank you very much for the video. Was working on similar project and couldn’t execute it for a long time, found your blog on the right time. Truly life saving, keep up the good work.

Ronny · March 31, 2012 at 7:22 pm

Verdammt gute Arbeit!
Ich danke vielmals!

Ezra · May 1, 2012 at 6:38 pm

Hi, thank you for this post. it helped me. But i tried to change frame’s background color as frame.setBackground( doesn’t work.

thank you..

schabby · May 2, 2012 at 11:01 am

Hi Ezra, you are trying to set the background of the Swing Component, which is not part of OpenGL. The command you are looking for is gl.glClearColor(...). I hope this helps, Johannes

Ezra · May 2, 2012 at 3:46 pm

ok, thank you ..

Hardik · May 3, 2012 at 11:57 am


I have download and do all the stuff that you have said in the video of JOGL in Eclipse ,And after that when i run your first program ‘HelloWorld’ following error is coming.
Can you please help me out? THX

Exception in thread “main” java.lang.Error: Unresolved compilation problem:
The type cannot be resolved. It is indirectly referenced from required .class files

at JOGLHW.HelloWorld.main(

    schabby · May 3, 2012 at 1:13 pm

    Hi Hardik, this is an interesting problem. Does your code completely compile? Are you sure, that you got all necessary libraries added to your classpath? If yes, do you have additional depenencies on the system, such as additional libraries that are part of your project? What JDK are you using? I myself used JDK 6 64bit.

    The problem appears to me, as if your current classpath does not contain the necessary* stuff. What OS are you using?



Hardik · May 3, 2012 at 2:04 pm

Hi schabby, i use 64-bit wnidows 7 OS. and also my code is not compile. There is error coming in line ‘GLCanvas glcanvas = new GLCanvas(capabilities);’ saying that ‘the type cannot be resolved . it is indirectly refrenced from required .class files’

Eilo · June 11, 2012 at 12:00 am

Thanks! Afer a dozen non-working tutorials (even the examples on the JOGL and Eclipse pages aren’t working properly…) finally one that works 🙂

Sebastien · June 29, 2012 at 8:27 pm

Hi i copied and pasted your code exactly as you said but im being thrown an error

Exception in thread “main” java.lang.IllegalArgumentException: Shared Drawable is null
Exception in thread “main” java.lang.IllegalArgumentException: Shared Drawable is null
at java.awt.Container.addNotify(Unknown Source)
at java.awt.Window.addNotify(Unknown Source)
at java.awt.Frame.addNotify(Unknown Source)
at Source)
at Source)
at java.awt.Component.setVisible(Unknown Source)
at java.awt.Window.setVisible(Unknown Source)

amit · July 5, 2012 at 6:04 pm

thanx dude.. it was a gr8 help..keep on awesome work!!

wokay · July 13, 2012 at 11:24 pm

I think it should actually be not for the second file. Anyways, thanks for all the help.

BD · July 20, 2012 at 10:30 am

Thanks! I could not figure out how to install this library correctly (tried it two days ago and gave up after two hours), but thanks to your tutorial I did it in a few minutes!

Nafiz · July 30, 2012 at 12:45 pm

I have a problem.

Although I did exactly same as the tutorial, even i watched the video. Even i tried other tutorial.But all of my try, i got that error everytime.

When i click to run, a error box display and “A Java Exception has occurred.”

And i see that errors in consol

Exception in thread “main” java.lang.NoClassDefFoundError: com/jogamp/common/type/WriteCloneable
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at Source)
at Source)
at$100(Unknown Source)

Even i uninstalled jdk&jre and i download last version and install. I am using eclipse, Windows 7 home premium 64 bit.

stackover link:

    schabby · July 30, 2012 at 3:00 pm


    hmm, my first bet is that there are the jogamp libraries missing. Could you tell me your _exact_ setup? What OS are you running? 32bit 64bit? What Java version are you using? Which download URL (ie. which version) did you pick? What native binaries are in your classpath?

    I am pretty sure we will get it to work.



Nafiz · July 30, 2012 at 3:18 pm

I did something but i didn’t understand exactly.

Now, i got this:

Exception in thread “main” java.lang.NoClassDefFoundError: com/jogamp/common/jvm/JVMUtil
at HelloWorld.main(
Caused by: java.lang.ClassNotFoundException: com.jogamp.common.jvm.JVMUtil

I am using windows 7 64 bit.
I have jre 7.I download it few days ago.

jogl-b633-2012-01-23_20-37-13, gluegen-b480-2012-01-23_16-49-04

I download them(windows amd64)
Also i added only “gluegen-rt.dll”

Same as you did.

    schabby · July 30, 2012 at 5:15 pm

    Hi Nafiz,

    I just checked in my setup in which JAR you find the class com/jogamp/common/type/WriteCloneable. It is definitely in gluegen-rt.jar. So adding this JAR will solve that problem. And this is probably what you did until you got stuck with the second problem

    So, as for the second problem (java.lang.NoClassDefFoundError: com/jogamp/common/jvm/JVMUtil), I can find this class in the package jogamp.common.jvm also in gluegen-rt.jat, however it is strange that this class is actually requested. I suspect, that your classpath contains other JARs that request this library. Therefore, I send you my eclipse project as a ZIP file via mail hoping that it will work for you.



Nafiz · July 30, 2012 at 9:07 pm

It’s work finally.
Thank you Johannes.

Your solution is work!

If you get JVMUtil or WriteCloneable error with NoClassDefFoundError, you must copy that 4 library to java/jre/lib/ext folder.

hjLee · October 9, 2012 at 4:48 am

감사합니다. Thank you.

Paula · November 6, 2012 at 11:49 pm

I am starting with JOGL and was struggling to find where to get those jars… You saved my day! Thank you for your great post. I could easily setup and run your example. You really made it simple. Can’t thank you enough for sharing this!

Amadeo Alonso · December 19, 2012 at 1:14 am

Simple and effective, as I like

Thanks a lot

Julien Gouesse · December 21, 2012 at 9:15 am


Your video is overcomplicated. Please can you update it?

As a first step, you should use the proper JVM (according to your architecture, you should use a 64 bits one). Then, you won’t need to extract the DLL, just do the same thing than in your video but you will see that it will simply work the very first time.

Your video gives the impression that JOGL 2.0 is not straightforward to install whereas we made some efforts to ease that. The latest release candidate can be downloaded on the main page, there is a link that points to this:

Best regards.

Julien Gouesse · December 21, 2012 at 9:17 am

@Nafiz Never copy JARs into java/jre/lib/ext, it can cause some version conflicts (further versions won’t be detected if you put an obsolete JAR here). Rather find the obsolete JAR(s) on your system and remove them.

Rob · March 5, 2013 at 11:10 am

The gluegen-rt.jar is mentioned twice in the include list!

Thanks for taking the trouble to make this tutorial.

Diogo · March 7, 2013 at 6:49 am

Great post and video, you save my life mate! hahaha

Ciprian Agapi · March 26, 2013 at 3:09 am

Thx soooo much!!! Gr8 Tutorial; saved me after hours of abysmal installation disasters 🙂


PS I started out with the jar files containing windows-i586 in their name, since I have an Intel laptop, but the only jar files that worked were the ones with amd64

Russell · March 30, 2013 at 8:27 pm

Thanks for the tutorial, works great. didn’t even have to do the extra steps in the vid, for some reason.

Mike · June 22, 2013 at 11:14 pm

Great stuff, thanks

fery · September 27, 2013 at 12:58 pm

Hello, Thanks million for your tutorial, I did all instruction which u provide but still I have problem, I am a beginner using opengl in java eclips, I import opengl files and try to write a simple code but codes with gl. is not recognized by this, will u please guide me how to solve the problem ??? many thanks in advance

René · November 23, 2013 at 12:29 am


gvanca · January 16, 2014 at 6:43 pm

thank you so much. i thought i would never get a hang of how it’s done ^_^ i’m in your dept

Monching · November 7, 2014 at 8:05 am

Hi. . i Followed your Tutorial.. but i always got this errors.

Exception in thread “main” java.lang.NoSuchMethodError:
at Method)
at de.schabby.jogl.helloworld.HelloWorld.main(

Please Help me. :'(

Im Monching · November 7, 2014 at 8:05 am

Hi. . i Followed your Tutorial.. but i always got this errors.

Exception in thread “main” java.lang.NoSuchMethodError:
at Method)
at de.schabby.jogl.helloworld.HelloWorld.main(

Please Help me. :'(

zakaria · May 14, 2015 at 1:21 am

Hi. . i Followed your Tutorial.. but i always got this errors.

Exception in thread “main” java.lang.NoSuchMethodError:
at Method)
at de.schabby.jogl.helloworld.HelloWorld.main(

Please Help me. :'(

Controlando a Calvície · February 26, 2017 at 4:59 am


JOGL Download · November 19, 2010 at 3:46 pm

[…] that you downloaded JOGL, you may be interested in my JOGL Hello World example (includes how to set up the classpath and DLLs […]

Building JOGL 2.0 lib properly · January 27, 2012 at 10:46 am

[…] I don't know how many JOGL 2 build instructions I have gone and none are working. JOGL Example – Tutorial – doesn't work How to build JOGL – doesn't work Downloading and installing JOGL – JogampWiki – same […]

Building JOGL 2.0 lib properly · December 21, 2012 at 9:56 am

[…] don't know how many JOGL 2 build instructions I have gone and none are working. JOGL Example – Tutorial – doesn't work How to build JOGL – doesn't work Downloading and installing JOGL – JogampWiki – same […]

Leave a Reply

Your email address will not be published. Required fields are marked *