tags:

views:

91

answers:

2

I am linking a native C++ library into my Java application using JNI. I loaded my library using System.loadLibrary() and everything appears to be working. I added the functionality to my C++ dll which is now making calls into multiple other dlls from third party software systems. Unfortunately one of these dlls is named ZIP.dll. The java loadLibrary operation is finding this dependent dll in the /jre/bin before looking in my project directory so it attempts to use that one. The two dlls are not identical so I am getting an UnsatisfiedLinkError saying that the specified procedure could not be found.

Is there a way to tell java where to look for dependent libraries when loading a dll?

A: 

I believe System.load with full path name rather than System.loadLibrary should do the trick.

Tom Hawtin - tackline
My library is dependent on a secondary library named zip.dll. System.load only allows me to specify the path to my library... from that point java goes out looking for all of the dependent libraries and it is finding the wrong one.I need a way to specify the path to the dependent libraries...
Kyle
A: 

I don't think it's possible to load two different DLLs with the same name at the same time. You can either change the ordering on the path so that the correct ZIP.dll is loaded first (this may then cause problems with the jvm) or you can rename your ZIP.dll file to something else. Renaming your ZIP.dll is probably the easiest way to go.

TwentyMiles