File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Other JSE/JEE APIs and the fly likes Can't find dependent libraries Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Can Watch "Can New topic

Can't find dependent libraries

Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
I changed from Microsoft Visual C++ (MSVC) 6 to MSVC 8 for building the native bits of my Java application on Windows. I now get the following at run-time: -

Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\users\peterc\hoperoot\trunk\jdfservices\javalicence\obj\win_32-pentium\a-a\msvcnt_8_0\EncryptTool.dll:Can't find dependent libraries

Note that this is not the message you get if Java cannot find the native library (DLL) implementing the native method it's trying to link. I have verified that, if I remove my DLL, I get a different message. Therefore, I conclude that it can find my DLL, but it cannot find some DLL on which my DLL depends.

I looked at my DLL in Windows Depends.exe tool. The only DLL that this couldn't find was DWMAPI.DLL. That's a Vista-specific DLL that ought not to get loaded on my XP box; lots of other programs that work fine have such a dependency, so I think DWMAPI.DLL is a "red herring".

Someone suggested running my program in a native debugger and putting a breakpoint on LoadLibrary() calls, but I haven't been able to work out how to do that.

Anyone have any bright ideas?

Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.

Joined: Oct 15, 2003
Posts: 4
you can download this free software dependency walker which tells you what are all the dlls on which your dll depends...i faced this problem too and got it solved through dependency walker
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
I was already using Dependency Walker (see where I referred to "Depends.exe").

The problem was to do with some darn-awful Windows confection called "manifest files". This is something that tells the OS where to find run-time dependency libraries. This is necessary for the C run-times compiled under MSVC 8.
I agree. Here's the link:
subject: Can't find dependent libraries
It's not a secret anymore!