无法启动.jar文件(使用LWJGL) [英] Can't start .jar file (using LWJGL)

查看:397
本文介绍了无法启动.jar文件(使用LWJGL)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

美好的一天!

我创建了jar文件(使用Netbeans),我无法启动它。该项目使用lwjgl库。在我的IDE中它运行良好。

I created jar file (using Netbeans) and i can't start it. This project uses lwjgl libraries. Inside my IDE it works well.

我使用下一个命令:

java -jar LWJGL_TimerExample.jar 

答案是:

Exception in thread "main" java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1758)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1045)
at org.lwjgl.Sys$1.run(Sys.java:73)
at java.security.AccessController.doPrivileged(Native Method)
at org.lwjgl.Sys.doLoadLibrary(Sys.java:66)
at org.lwjgl.Sys.loadLibrary(Sys.java:82)
at org.lwjgl.Sys.<clinit>(Sys.java:99)
at org.lwjgl.opengl.Display.<clinit>(Display.java:130)
at Sourse.TimerExample.start(TimerExample.java:32)
at lwjgl_timerexample.Main.main(Main.java:21)

其他项目(没有这个库)可以正常工作。我该如何解决这个错误?

Other projects (without this libraries) work fine. How can i solve this error?

我的清单是:

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.1
Created-By: 1.6.0_26-b03-384-10M3425 (Apple Inc.)
Main-Class: lwjgl_timerexample.Main
Class-Path: lib/jinput.jar lib/lwjgl.jar lib/lwjgl_util.jar
X-COMMENT: Main-Class will be added automatically by build


推荐答案

它不会像你现在尝试的那样工作,因为你需要将jar中的本机文件放在jar旁边并通过'-Djava.library.path'参数指向它们。

It's not going to work the way you're trying to currently do it, since you need to have the native files along side the jar and point to them via the '-Djava.library.path' parameter.

如果你只想要一个罐子并且想要避免命令行和本机文件的麻烦使用 JarSplice 工具。 JarSplice 易于使用,并会自动为您处理本机文件。

If you just want a single jar and want to avoid the hassle of the command line and native files use the JarSplice tool. JarSplice is easy to use and will automatically handle the native file stuff for you.

1)只需将项目(类和资源)导出到jar(更容易通过IDE完成)。

1) Simply export your project (class and resources) to a jar (easier just to do it through your IDE).

2)然后运行JarSplice,将所需的所有罐子添加到jar选项卡(你的app jar,lwjgl.jar和你正在使用的任何其他外部jar) 。

2) Then run JarSplice, add all the jars you need to the jars tab (your app jar, lwjgl.jar, and any other external jar you're using).

3)然后在natives选项卡上添加所有本机文件(windows * .dll,linux * .so,mac * .dylib& * .jnilib)。

3)Then on the natives tab add all the natives files (windows *.dll, linux *.so, mac *.dylib & *.jnilib).

4)在课程选项卡上添加您的主班级。然后创建你的jar。

4)On the class tab add your main class. Then create your jar.

然后你可以通过双击它来运行这个jar(或者如果你希望通过命令行使用'java -jar yourapp.jar')。

You can then run this jar just by double clicking it (or if you wish via command line using 'java -jar yourapp.jar').

这篇关于无法启动.jar文件(使用LWJGL)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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