lwjgl.dll: Can't find dependent libraries

Started by Robin183, September 01, 2011, 14:12:11

Previous topic - Next topic

Robin183

Hello. I'm fairly new to LWJGL (and more advanced programming in general) and have been having some problems getting my project to run after reinstalling Windows.
The problem is that I get an UnsatisfiedLinkError when I try running my project. It worked fine before reinstalling Windows, but now I haven't been able to run it at all.

I'm using the 64 bit version of Eclipse IDE for Java Developers on Windows 7 64 bit and my JDK is also 64 bit. I've got both 32 and 64 bit JRE, though. I can't remember whether I used a 32 bit JDK before my re-installation of Windows, but I assume not (though I have a slight memory of having some 64-bit Java-related problems in the past, so I might have been "forced" to).

I've checked my Build Path over and over again and both the JAR and the DLL is where I've told Eclipse. I've got DLLs for both 32 and 64 bit systems in the same folder, but as far as I can see it seems as if it always tries to use the 32 bit DLL and then fails.

I'm also using Slick2D, if that matters.

The full error is
QuoteException in thread "main" java.lang.UnsatisfiedLinkError: C:\Users\Robin\Desktop\Folders\Programming\Java\eclipse\workspaces\project\MazeGame\libs\natives\lwjgl.dll: Can't find dependent libraries
   at java.lang.ClassLoader$NativeLibrary.load(Native Method)
   at java.lang.ClassLoader.loadLibrary0(Unknown Source)
   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:75)
   at java.security.AccessController.doPrivileged(Native Method)
   at org.lwjgl.Sys.doLoadLibrary(Sys.java:68)
   at org.lwjgl.Sys.loadLibrary(Sys.java:84)
   at org.lwjgl.Sys.<clinit>(Sys.java:101)
   at org.lwjgl.opengl.Display.<clinit>(Display.java:128)
   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 game.maze.MazeGame.main(MazeGame.java:42)

I've tried adding both "C:\Program Files\Java\jdk1.6.0_26\jre\bin" and "C:\Program Files\Java\jdk1.6.0_26\bin" to my Path system variable according to this post http://lwjgl.org/forum/index.php/topic,2860.msg15780.html#msg15780.
I've tried moving the JARs and DLLs to different folders (and reassigning them to their new locations in the build path, of course).
I've tried removing the 32 bit DLLs to see if I could get it to use the 64 bit. This (as I expected) only caused another error (UnsatisfiedLinkError: no lwjgl in java.library.path).

I'm pretty much out of ideas as of now and it's possible that I've simply overlooked something really simple. As I said, I'm pretty new to this. I am willing to use the 32 bit JDK if that would help, but I'd prefer to try anything else before that as it feels like downgrading my equipment.

kappa

IIRC the natives for windows aren't found inside

QuoteC:\Users\Robin\Desktop\Folders\Programming\Java\eclipse\workspaces\project\MazeGame\libs\natives\lwjgl.dll

but inside the subfolder in there called 'windows'

So you'll have to change the path to the natives to something like

QuoteC:\Users\Robin\Desktop\Folders\Programming\Java\eclipse\workspaces\project\MazeGame\libs\natives\windows\lwjgl.dll:

Robin183

In the original zip they were structured like that, though I changed the directories a bit (as I only needed the ones for windows for testing, anyway). I've now moved them all back the way they were organized in the zip (though I still haven't copied the non-Windows ones into my project) and changed the build paths to mirror my changes. Still the same, though, but it now says "\native\windows\lwjgl.dll" instead of just "\natives\lwjgl.dll".

On the Slick2D wiki (http://slick.cokeandcode.com/wiki/doku.php?id=getting_started_and_setup) they state that
QuoteIf you are seeing errors including the term 'UnsatisifiedLinkError' when trying to run the demos or the application this always means that Java cannot find the native libraries.

On Windows the library path includes the current directory. So if you run from the location of the DLLs they should automatically be found.

Now, what directory would this be in the case of an Eclipse project? If I find that out, I could try just putting them there to see what happens.

kappa

have you tried following the eclipse tutorial found here? Should be enough to get you going.

Robin183

I checked through that tutorial the first time I did this, but not this time. Everything seemed to be the way I had done it, except that I avoid using the External JAR-button because I'd like to keep my workbench (and it's projects) portable since it's all for a school project.

Anyway, I re-extracted the entire lwjgl-2.7.1 zip and put it in an empty project (not sure if there's any reason not too keep it there, even though it's not really the common way to do it, I suppose) and then I did the same for slick. After that I, yet again, changed the build path to point to the jars and the /native/windows/ folder in the new project, and all of a sudden it all works just fine.

Still not sure what did the trick, but I assume there's some file in there that I hadn't extracted before (and for some reason wasn't needed on my previous Windows-installation) that I need to run it now. So thanks for the help, I just wish I knew which part did the trick but I'm too afraid to try reversing it and redoing it step by step to find out. :P