0

I am very new to java but have been really enjoying it so far. Progress has been fast and I almost have a little demo game fully working.

However when I export it (I'm using Eclipse) the .jar won't run properly (it loads to a grey screen and sits there), yet it would run perfectly fine before the sounds were added.

Launched via CMD with java -jar path to jar gives me this error:

"Exception in thread "Thread-2" java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path"

I've been looking around online about this for an hour now and I've readded and relinked the libraries many many times yet the error still persists. I am hoping its just some rookie mistake I am making and not some wierd personal system error or something. That would be a bit of a bummer.

Picture of my library paths

(Yeah my name is Matt)

I also went to JRE system library and set the 'Native Library Location' there to the same location as above.

It does run fine if ran from within Eclipse so the files do work. I had wondered if maybe they're old versions or something but if it works in Eclipse then it should work when its exported... exported correctly, anyway.

This is very frustrating so thank you in advance for any help!

Havik
  • 3
  • 1

1 Answers1

0

When your program cant find the a library when exported from eclipse it is typically because you either forget to bundle the lwjgl files along with your app (.dll & .so native files), or it was not linked correctly.

See here for your exact issue: Can't start .jar file (using LWJGL)

You probably forgot to use -Djava.library.path=path/to/dir

-

And you can find a more generic info here:

See here for more info: java.lang.UnsatisfiedLinkError no *****.dll in java.library.path

Community
  • 1
  • 1
sorifiend
  • 5,927
  • 1
  • 28
  • 45
  • Thank you very much. I had been attempting to use JarSplice but without any luck however after using that tutorial - I have a working .jar! I noticed I have to keep the res folder in the same directory as the jar though .. is there a way I can 'package' the resources (ogg sound files etc) with the jar itself? Not sure its possible with a jar but maybe an exe? – Havik Apr 29 '16 at 02:22
  • It is possible with both a jar and an exe, but its a very in depth subject. Don't forget to select this answer as solved using the tick. – sorifiend Apr 29 '16 at 02:53
  • Ok, I'll have a look into it. And sure thing (cheers for the reminder, am new here!) – Havik Apr 29 '16 at 07:09