我正在制作一个小型平台游戏,我想学习如何使它成为一个可运行的jar文件。
我使用eclipse将项目导出为可运行的jar文件,并创建了一个汽车文件。但是,每当我双击它创建的jar文件时,都没有任何反应。
所以,我尝试通过导航到我的桌面(我保存jar文件)并使用java -jar ShittyJumper.jar(我文件的名称)从cmd行运行jar文件。
当我点击输入时,我得到两个错误:
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoa
der.java:58)
Caused by: java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
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:95)
at org.lwjgl.Sys.<clinit>(Sys.java:112)
at org.lwjgl.opengl.Display.<clinit>(Display.java:132)
at org.newdawn.slick.AppGameContainer$1.run(AppGameContainer.java:39)
at java.security.AccessController.doPrivileged(Native Method)
at org.newdawn.slick.AppGameContainer.<clinit>(AppGameContainer.java:36)
at main.Main.main(Main.java:26)
... 5 more
C:\Users\Haden\Desktop> -Djava.library.path=lib/lwjgl/natives -jar ShittyJumper.
jar
'-Djava.library.path' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\Haden\Desktop>-Djava.library.path=windows -jar ShittyJumper.jar
'-Djava.library.path' is not recognized as an internal or external command,
operable program or batch file.
我已经在eclipse中配置了我的构建路径,以包含lwjgl本机windows文件夹。
如何为我的游戏创建可运行的jar文件?