0

I made some small game and I want to export it.I export it as runnable JAR file but when I try to open it nothing happens. I am using couple of external libraries(slick, jinput, jogg, jorbis and jwjgl). Can someone help me make my program work? This is my error screen:

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.openal.AL.<clinit>(AL.java:59)
    at org.newdawn.slick.openal.SoundStore$1.run(SoundStore.java:295)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.newdawn.slick.openal.SoundStore.init(SoundStore.java:292)
    at org.newdawn.slick.Sound.<init>(Sound.java:54)
    at com.pitcher654.main.AudioPlayer.load(AudioPlayer.java:18)
    at com.pitcher654.main.Game.<init>(Game.java:60)
    at com.pitcher654.main.Game.main(Game.java:317)
    ... 5 more
  • 1
    Run it from the command line with `java -jar ...` and see what errors you get. – Jon Skeet Jan 30 '16 at 09:24
  • Please put it *in the question*. – Jon Skeet Jan 30 '16 at 09:47
  • Its probably because for some reason my external libraries arent packed inside JAR file, but I'm just guessing – Domagoj Sabolic Jan 30 '16 at 09:49
  • Yes, I wouldn't *expect* them to be packed inside the jar file. You should copy them alongside your jar file. In this case, it looks like it's a native library that's causing the problem... – Jon Skeet Jan 30 '16 at 09:53
  • Hmm.. any ideas how to fix it? And I have Libs folder next to my JAR file where all the libraries are. – Domagoj Sabolic Jan 30 '16 at 09:54
  • Well where is the native library, and what is your java.library.path? – Jon Skeet Jan 30 '16 at 09:59
  • Im not sure when I exported it i chose package required library in the JAR file – Domagoj Sabolic Jan 30 '16 at 10:12
  • One of your dependencies - lwjgl - has native code (a dll or so file depending on your operating system). You'll need those files in the same folder as the jar when you run it, or you'll need to add code to load the files from the jar. This link might help you: http://stackoverflow.com/questions/2937406/how-to-bundle-a-native-library-and-a-jni-library-inside-a-jar – Andrew Young Jan 30 '16 at 11:24
  • Okay thanks it works now! – Domagoj Sabolic Jan 30 '16 at 11:47

0 Answers0