所以我试图在eclipse中学习JOGL但是每次运行我的代码时我都会收到错误,表明他们找不到引用的库,但我知道它们被引用,因为eclipse已将它们列在生成的文件夹中“Referenced图书馆“他们是英特尔,我的机器是英特尔。
代码不生成错误标记,但在尝试运行时发出系统错误。我收到以下错误
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)
我的代码如下
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);
}
}
还有什么可以发送这些错误? eclipse真的没有引用这个吗?我已经完成了几个方面,包括java构建路径。我也在这里完成了这个解决方案,我收到了同样的错误
JOGL Exception- Can't find gluegen- rt in java.library.path
我已经进入配置构建路径,然后进入库并将它们添加到它们中,两者都在一个包含文件的now文件夹中,然后将它们放入其中。
一些建议/帮助表示赞赏,因为我在这里不知所措。
答案 0 :(得分:1)
请关注these detailed instructions for Eclipse。
包含本机库的JAR必须与包含Java库的JAR位于同一目录中。例如,gluegen-rt.jar和gluegen-rt-natives - * .jar必须位于同一目录中。