0
votes

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?

2

2 Answers

2
votes

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

0
votes

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.