I was trying to test a sample jogl demo application. However, when I build the application by using eclipse, I got the following error:
Exception in thread “main” java.lang.UnsatisfiedLinkError: no jogl in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1682)
at java.lang.Runtime.loadLibrary0(Runtime.java:822)
at java.lang.System.loadLibrary(System.java:992)
at com.sun.opengl.impl.NativeLibLoader$DefaultAction.loadLibrary(NativeLibLoader.java:78)
I have already added the -Djava.library.path={my jogl.dll directory} into the vm argument input box. And my jogl.jar does not include any dll inside.
When I was using ant to build the same application, I will not get the same error. However, I need to use eclipse to debug my code so I have to make
eclipse work.
After I debug the source code, I found the following interesting thing:
When I add System.loadLibrary(“jogl”) in the main function of my application, the library can be loaded. However, when the class of WindowsGLDrawableFactory
has been loaded by a classloader after the method Class.forName(), the loadLibrary(“jogl”) will fail.
Does anyone have this problem before? Any suggestions will be appreciated. Thanks.