1
votes

I get an error when I try to run my JOGL code, here is the code:

import javax.media.opengl.GLCapabilities;
public class Jogl {
   public static void main (String args[]) {
      try {
         System.loadLibrary("jogl");
         System.out.println(
            "Hello World! (The native libraries are installed.)"
         );
        GLCapabilities cap = new GLCapabilities(null);
        System.out.println(
            "Hello JOGL! (The jar appears to be available.)"
         );
      } catch (Exception e) {
         System.out.println(e);
      }
   }
}

The error is:

Exception in thread "main" java.lang.UnsatisfiedLinkError: no jogl in java.library.path at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1857) at java.lang.Runtime.loadLibrary0(Runtime.java:870) at java.lang.System.loadLibrary(System.java:1119) at Jogl.main(Jogl.java:5)

I have just gone through the JOGL installation tutorial on their wiki.

1
Did you also add the jogl-all-natives-*.jar files to your classpath? - Marco13
Which IDE are you using? - Terje
I am using Eclipse. How do I add the natives.jar? I only added what the wiki said to add. - Peter
possible duplicate of Problems compiling files using JOGL - Arve
You are obviously already using the jogl-all.jar, and you probably added this by right-clicking it in Eclipse, and selecting "Add to build path". You can do the same with the jogl-all-natives-windows-amd64.jar (or whatever JAR is the right one for your system...) - Marco13

1 Answers

0
votes

You don't have to call System.loadLibrary("jogl"), GlueGen does it for you. Please strictly follow our instructions in our wiki. We indicate nowhere that the developer must load the native libraries by himself, it isn't necessary in the general case. If you don't want to use the automatic extraction and loading of native libraries, look at our user's guide, disable it and set your Java library path correctly. Look at that, don't forget GlueGen.

The questions specific to JOGL should be asked on our official forum so that our maintainers, contributors and users can answer you. Only a very few JogAmp maintainers come here.