英文:
'No lwjgl in java.library.path'
问题
我需要从Eclipse中导出一个lwjgl 2应用程序。
我导出了jar文件(TS.jar),用jarsplice将jar包和本地库添加到其中(TS_FULL.jar),然后从命令行运行应用程序:
java TS_FULL.jar
但它说找不到主类,很奇怪,因为在导出时我勾选了“创建清单”并选择了正确的主类,即Main.Main。
所以我用以下方式指定了主类:
java -cp TS_FULL.jar Main.Main
这次它找到了主类,但抛出了一个错误:
UnsatisfiedLinkError: no lwjgl in java.library.path
我不明白为什么会这样,因为我在Eclipse项目设置中正确地添加了jar包和本地库,请参见附件。
如果能得到任何帮助,将不胜感激,谢谢。
编辑:
好吧,我现在太累了,暂时没有时间深入研究,但显然如果我运行
java -jar TS_FULL.jar
它可以正常运行。
如果我使用
java TS_FULL.jar
它将找不到主类。
如果我运行
java -cp TS_FULL.jar Main.Main
它会找到主类,但无法找到lwjgl.dll。我不知道为什么,我会进一步研究。不管怎样,我很高兴我解决了问题,至少部分解决了。至少现在可以运行了。
英文:
I need to export a lwjgl 2 App from eclipse.
I export the jar file (TS.jar), add the jars and natives to it with jarsplice (TS_FULL.jar), run the app from cmd with:
java TS_FULL.jar
and it says it cant find main class, strange given that at export time I checked "create manifest" and selected the correct main class, which is Main.Main.
So I specify the main class with:
java -cp TS_FULL.jar Main.Main
This time it finds the main class but throws a:
UnsatisfiedLinkError: no lwjgl in java.library.path
I dont understand why this happens since I correctly added both jars and natives in the eclipse project setup, see attachement.
Any help would be appreciated, thanks.
EDIT:
Ok so Im too tired to look into it right now, but apparently if I run
java -jar TS_FULL.jar
it runs fine.
If I use
java TS_FULL.jar
it wont find the main class.
If I run
java -cp TS_FULL.jar Main.Main
it will find the main class but wont find the lwjgl.dll. I dont know why, I will look into it. Anyway Im happy I solved it, partially at least. At least it works now.
专注分享java语言的经验与见解,让所有开发者获益!
评论