CodyDester
CodyDester

Reputation: 41

JOGL libraries can't load libraries but they're in the referenced libraries folder

So I'm trying to learn JOGL in eclipse however every time I run my code I get errors indicated they can't find the referenced libraries, however I know they are referenced because eclipse has them listed in the generated folder "Referenced Libraries" and they are intel and my machine is intel.

The code generates no error tags but sends out system errors when I try to run it. I get the following errors

Exception in thread "main" java.lang.UnsatisfiedLinkError: Can't load library: 

C:\Users\Cody\new\workspace\render\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:64)

    at com.jogamp.common.jvm.JNILibLoaderBase$DefaultAction.loadLibrary(JNILibLoaderBase.java:96)

    at com.jogamp.common.jvm.JNILibLoaderBase.loadLibrary(JNILibLoaderBase.java:459)

    at com.jogamp.common.os.DynamicLibraryBundle$GlueJNILibLoader.loadLibrary(DynamicLibraryBundle.java:388)

    at com.jogamp.common.os.Platform$1.run(Platform.java:209)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.jogamp.common.os.Platform.<clinit>(Platform.java:179)
    at javax.media.opengl.GLProfile.<clinit>(GLProfile.java:120)
    at hellowordjogl.render.main(render.java:59)

my code is as follows

package hellowordjogl;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.DisplayMode;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.Point;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLEventListener;
import javax.media.opengl.GLProfile;
import javax.media.opengl.awt.GLCanvas;
import javax.media.opengl.glu.GLU;
import javax.swing.AbstractAction;
import javax.swing.ActionMap;
import javax.swing.InputMap;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.KeyStroke;
import javax.swing.Renderer;

import com.jogamp.graph.curve.opengl.RenderState;
import com.jogamp.opengl.util.FPSAnimator;

 public class render implements GLEventListener{

    @Override
    public void display(GLAutoDrawable arg0) {
        // TODO Auto-generated method stub      
    }

    @Override
    public void dispose(GLAutoDrawable arg0) {
        // TODO Auto-generated method stub      
    }

    @Override
    public void init(GLAutoDrawable arg0) {
        // TODO Auto-generated method stub      
    }

    @Override
    public void reshape(GLAutoDrawable arg0, int arg1, int arg2, int arg3,
            int arg4) {
        // TODO Auto-generated method stub      
    }           

    public static void main(String[] args) {
        //
        final GLProfile profile = GLProfile.get(GLProfile.GL2);
        GLCapabilities capabilities = new GLCapabilities(profile);

        // canvas

        final GLCanvas glcanvas = new GLCanvas(capabilities);
        render r = new render();
        glcanvas.addGLEventListener(r);
        final FPSAnimator animator = new FPSAnimator(glcanvas, 300,true);
        // pass in glcanvas to jframe
        final JFrame frame = new JFrame ("test 1");
        frame.getContentPane().add(glcanvas);       

        //shutdown process

        frame.addWindowListener(new WindowAdapter(){
            public void windowClosing(WindowEvent e){
                if(animator.isStarted())
                    animator.stop();
                System.exit(0);
            }

        });

        // center screen and make it visible

        frame.setLocationRelativeTo(null);
        frame.setVisible(true);     
    }       
    }

What else could be sending these errors? Is eclipse really not referencing this? I've done it a few ways including java build path. I have also done this solution here and I receive the same errors

JOGL Exception- Can't find gluegen- rt in java.library.path

I have gone also into configuration build path then to libraries and added them in their, both in a now folder with files in them and then having just put them their.

Some advice/help is appreciated as I'm at a loss here.

Upvotes: 4

Views: 4323

Answers (1)

gouessej
gouessej

Reputation: 4075

Please follow these detailed instructions for Eclipse.

The JARs containing the native libraries must be in the same directory than the JARs containing the Java libraries. For example, gluegen-rt.jar and gluegen-rt-natives-*.jar must be in the same directory.

Upvotes: 1

Related Questions