org.lwjgl.system.Library错误 [英] org.lwjgl.system.Library error

查看:94
本文介绍了org.lwjgl.system.Library错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Eclipse中设置了LWJGL 3,当我尝试从



还有一种方法可以使用哪个本地库可以按照Jar添加。



在构建路径中展开lwjgl.jar>选择本机路径>单击编辑>单击工作区>选择本机目录



查看下面的图像








I set up LWJGL 3 in Eclipse, and it's giving me this error when I try to run the test code from https://www.lwjgl.org/guide:

Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class org.lwjgl.system.Library
    at org.lwjgl.system.MemoryAccess.<clinit>(MemoryAccess.java:22)
    at org.lwjgl.system.Pointer.<clinit>(Pointer.java:22)
    at org.lwjgl.glfw.GLFW.<clinit>(GLFW.java:594)
    at HelloWorld.run(HelloWorld.java:30)
    at HelloWorld.main(HelloWorld.java:109)

I made sure that everything is set up correctly, and I just can't place my finger on the problem. What's wrong?

解决方案

You're missing the native libraries.

As described in this link https://www.lwjgl.org/guide you'll have to setup java.library.path to the native library location.

I downloaded the library and copied the HelloWorld code in the above link in HelloWorld.java inside the directory where I extracted the library.

So the contents inside looks like below

/HelloWorld.java
/build.txt
/doc
/jar
/native
/src.zip

I compiled and ran the HelloWorld.java as below

Compilation (Path separator on linux would be : so there it would be -classpath jar/*:.)

javac -classpath jar/*;. HelloWorld.java

Run

java -classpath jar/*;. -Djava.library.path=native HelloWorld

And this works.

Edit*

I downloaded the library from https://www.lwjgl.org/download (Download Release.)

In eclipse you can add the native library to your path by simply including it on source path. Like below:

There's one more way using which native library can be added per Jar basis.

Expand lwjgl.jar in build path > select native path > click on edit > click workspace > select native directory.

See the images below

这篇关于org.lwjgl.system.Library错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆