Schabby's Blog
Reserve Orbital Defence Commander

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.


  1. JOGL Download
  2. Building JOGL 2.0 lib properly

50 Antworten

  1. wdaogang says:

    thanks a lot .非常谢谢

  2. Junior says:

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

  3. schabby says:

    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? :)

  4. luis says:

    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

  5. luis says:

    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.

  6. 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.

  7. schabby says:

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

    Best Regards!


  8. Shura says:

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

  9. schabby says:

    Hi Shura, cool, I am glad it helped :)


  10. testpilot says:

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


    as a shortcut instead.

  11. slash13 says:

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

  12. mercutio says:


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


  13. schabby says:


    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.

  14. Yogesh says:

    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.


  15. Johannes says:

    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.

  16. mrtipper says:

    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?

  17. schabby says:

    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!!


  18. Vishu says:

    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.

  19. Ronny says:

    Verdammt gute Arbeit!
    Ich danke vielmals!

  20. Ezra says:

    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..

  21. schabby says:

    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

  22. Ezra says:

    ok, thank you ..

  23. Hardik says:


    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(

  24. schabby says:

    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?



  25. Hardik says:

    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'

  26. Eilo says:

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

  27. Sebastien says:

    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)

  28. amit says:

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

  29. wokay says:

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

  30. BD says:

    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!

  31. Nafiz says:

    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:

  32. schabby says:


    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.



  33. Nafiz says:

    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.

  34. schabby says:

    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.



  35. Nafiz says:

    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.

  36. hjLee says:

    감사합니다. Thank you.

  37. Paula says:

    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!

  38. Amadeo Alonso says:

    Simple and effective, as I like

    Thanks a lot

  39. Hi

    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.

  40. @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.

  41. Rob says:

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

    Thanks for taking the trouble to make this tutorial.

  42. Diogo says:

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

  43. Ciprian Agapi says:

    Thx soooo much!!! Gr8 Tutorial; saved me after hours of abysmal installation disasters :-)

    U DA MAN

    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

  44. Russell says:

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

  45. Mike says:

    Great stuff, thanks

  46. fery says:

    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

  47. René says:


  48. Im Monching says:

    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. :'(

Post Comment

Please notice: Comments are moderated by an Admin.