Hello.
I have wrote a simple JOGL application. public class Main implements GLEventListener { private GLU glu; private GLUT glut; private GL2 gl; public static void main(String[] args) { GLProfile glProfile = GLProfile.getDefault(); GLCapabilities capabilities = new GLCapabilities(glProfile); GLWindow window = GLWindow.create(capabilities); window.setTitle("JOGL test"); window.setSize(1024, 720); window.setVisible(true); window.addWindowListener(new WindowAdapter() { @Override public void windowDestroyed(WindowEvent e) { System.exit(0); } }); window.addGLEventListener(new Main()); FPSAnimator fpsAnimator = new FPSAnimator(window, 60); fpsAnimator.start(); } @Override public void init(GLAutoDrawable drawable) { glu= GLU.createGLU(drawable.getGL().getGL2()); glut=new GLUT(); gl=drawable.getGL().getGL2(); } @Override public void dispose(GLAutoDrawable drawable) { } @Override public void display(GLAutoDrawable drawable) { gl.glClear(GL2.GL_COLOR_BUFFER_BIT); gl.glClearColor(0f, 0f, 0f, 0); gl.glMatrixMode(GL2.GL_MODELVIEW); gl.glLoadIdentity(); glu.gluLookAt(5, 5, 5, 0, 0, 0, 0, 1, 0); gl.glColor3f(0.6f,0.6f,0.6f); glut.glutSolidCube(1); } @Override public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { gl.glViewport(0,0,1024,720); gl.glMatrixMode(gl.GL_PROJECTION); gl.glLoadIdentity(); glu.gluPerspective(40,(float)1024/720,0.1f,3000); gl.glMatrixMode(gl.GL_MODELVIEW); } It's really simple. In IDE (Intellij IDEA) it works fine. But when I have built a JAR file using Maven and tried to run it - i got an exception. Exception in thread "main" java.lang.UnsatisfiedLinkError: Can't load library: D:\IdeaProjects\jogl-test\target\gluegen-rt.dll at java.lang.ClassLoader.loadLibrary(Unknown Source) at java.lang.Runtime.load0(Unknown Source) at java.lang.System.load(Unknown Source) at com.jogamp.common.jvm.JNILibLoaderBase.loadLibraryInternal(JNILibLoaderBase.java:596) at com.jogamp.common.jvm.JNILibLoaderBase.access$000(JNILibLoaderBase.java:63) at com.jogamp.common.jvm.JNILibLoaderBase$DefaultAction.loadLibrary(JNILibLoaderBase.java:95) at com.jogamp.common.jvm.JNILibLoaderBase.loadLibrary(JNILibLoaderBase.java:459) at com.jogamp.common.os.DynamicLibraryBundle$GlueJNILibLoader.loadLibrary(DynamicLibraryBundle.java:421) at com.jogamp.common.os.Platform$1.run(Platform.java:317) at java.security.AccessController.doPrivileged(Native Method) at com.jogamp.common.os.Platform.<clinit>(Platform.java:287) at com.jogamp.opengl.GLProfile.<clinit>(GLProfile.java:146) at Main.main(Main.java:18) Okay. Actually I thought that Maven will download all needed libraries. Then i have placed gluegen-rt.dll into a folder with JAR file and tried again to run it, but got another exception. Exception in thread "main" java.lang.UnsatisfiedLinkError: jogamp.common.os.MachineDataInfoRuntime.getPointerSizeInBytesImpl()I at jogamp.common.os.MachineDataInfoRuntime.getPointerSizeInBytesImpl(Native Method) at jogamp.common.os.MachineDataInfoRuntime.getRuntimeImpl(MachineDataInfoRuntime.java:129) at jogamp.common.os.MachineDataInfoRuntime.initialize(MachineDataInfoRuntime.java:50) at com.jogamp.common.os.Platform.<clinit>(Platform.java:339) at com.jogamp.opengl.GLProfile.<clinit>(GLProfile.java:146) at Main.main(Main.java:18) So is there a problem with libraries? How to make it run? I use this dependencies. <dependency> <groupId>org.jogamp.gluegen</groupId> <artifactId>gluegen-rt</artifactId> <version>2.3.1</version> </dependency> <dependency> <groupId>org.jogamp.jogl</groupId> <artifactId>jogl-all</artifactId> <version>2.3.1</version> </dependency> |
Administrator
|
This post was updated on .
Hi
I have used Maven with JogAmp's Ardor3D Continuation (based on JOGL) for several years without any trouble, maybe you can have a look at my pom files: https://github.com/gouessej/Ardor3D When the JARs containing the native libraries are in the same directory than the JARs containing the Java libraries, the automated native library loading works (i.e no UnsatisfiedLinkError). Your last error occurs because the native libraries and the Java libraries mismatch, you mix the native libraries and the Java libraries of two distinct versions of JOGL. If you want to run your applications by using your IDE specific settings, look at this webpage in the wiki: http://jogamp.org/wiki/index.php/Setting_up_a_JogAmp_project_in_your_favorite_IDE I don't use Maven to run my JOGL applications, there is at least one contributor able to help you on our IRC channel about Maven in general. Edit.: It reminds me an error message someone else had, you mix the latest GlueGen JAR (2.3.1) with an old DLL (< 2.3.1) or the DLL of the appropriate bitness isn't used (a 32-bit VM even on a 64-bit OS can only load 32-bit native libraries). Edit.2: gluegen-rt-natives-*.jar and jogl-all-natives-*.jar should be in the same directory than jogl-all.jar and gluegen-rt.jar, those 2 JARs should be in the classpath.
Julien Gouesse | Personal blog | Website
|
Yes. You are right. One of problems was in that dll. But after that i got error like this
Profile GL_DEFAULT is not available on null, but: [] And after few hours I have decided to look at yours POM file one more time, and then i decided just add -main to artifactId value and yes! Finally it works! Woohoo!!! Thanks. |
Administrator
|
You're welcome, I don't remember why I used "gluegen-rt-main" and "jogl-all-main" but I'm glad to see it works.
By the way, you can use Maven Assembly Descriptor to put the native libraries into the right location in a fat JAR, I just try to anticipate. It's useful to know that if you plan to make a fat JAR from your application.
Julien Gouesse | Personal blog | Website
|
Free forum by Nabble | Edit this page |