Reputation: 1
My java game (built using lwjgl and Eclipse) won't run after being exported as a Runnable jar from Eclipse. The program runs fine within Eclipse, and the exported jar has the correct Manifest file format. After executing this Jar, it gave me an error:
C:\Users\7rent\Desktop>java -jar hw.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(JarRsrcLoader.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:135)
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 core.SecDef.main(SecDef.java:13)
... 5 more
I then (using Stack overflow answers) used JarSplice to add the lwjgl jar and natives to this Jar. The resulting fatjar gives me this:
C:\Users\7rent\Desktop>java -jar SD.jar
Error: Could not find or load main class core.SecDef
The manifest of the jar contains this: https://i.sstatic.net/ccpOH.png
and the inside of the FatJar looks like this: https://i.sstatic.net/hVBcD.png
I installed the JRE and JDK today, both latest versions with no configuration done to system variables. The project is set to be in compliance with java 6.
Thanks in advance :)
Upvotes: 0
Views: 349
Reputation: 10145
The reason is given in the exception stack trace:
Caused by: java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path
The JVM didn't find the lwjgl
native library.
Upvotes: 0