Tue, 07/12/2016 - 20:10
Hi,
First of all, here is the list of that I'm using to develop in Java:
- OS=Windows 10 64 bits
- Using Eclipse to develop in Java (Eclipse "Kepler")
- Using Java Runtime JRE 1.8.0_91 64 bits
And this is what my coworker is using to develop in C
- OS=Windows 10 64 bits
- Microsoft Visual Studio 2015
- OpenCASCADE7.0.0-vc12-64
Well, my coworker has developed some code in C and using OpenCascade. I'm trying to use JNI to use what he developed. I already know how to use JNI, since I run a few basic examples (how to create de ".h" file using "javah", how to include that file when compiling the C code in Visual Studio, how the Java methods must match some methods in the ".h" file which must match some funcions in the C code, etc). When my coworker gave me an initial simple code in C, I was able to call one of his simple C methods from JNI, so I think I already know the basics about how to use JNI.
The problem started when he started using OpenCascade in his C code. This is what I get, and it happens with the System.loadLibrary(NEInterface3D) method:
java.lang.UnsatisfiedLinkError: Z:\Brian\NestingBusiness\Archivos\NEInterface3D.dll: Can't find dependent libraries
java.lang.ClassLoader$NativeLibrary.load(Native Method)
java.lang.ClassLoader.loadLibrary0(Unknown Source)
java.lang.ClassLoader.loadLibrary(Unknown Source)
java.lang.Runtime.loadLibrary0(Unknown Source)
java.lang.System.loadLibrary(Unknown Source)
NEInterface3D.JNIStep.<clinit>(JNIStep.java:27)
The problem is NOT that JNI can not find the file "NEInterface3D.dll" which is the main DLL, but that some libraries can not be found. What libraries exactly? I don't know.
I already used "Dependency Walker" (http://www.dependencywalker.com) and I see a tonelade of files that seems to be missing, most of them in the form "API-MS-WIN-**************" which, according to what I read somewhere, is a false alarm. That is very misleading.
Here are my questions:
- How can I know exactly what files are missing when I get the Java exception java.lang.UnsatisfiedLinkError?
- How can I know exactly what are ALL the libraries what are "missing"? Are those DLLs, or maybe something else?
- Where do I get all those missing files from?
- Where do I have to place all those missing files, how do I tell Java/JNI where they are? I'm already using this to tell Java/JNI where is the main ".dll" file and it works: -Djava.library.path="(Windows path)"
I'm very seasoned with Java, but I'm not a C developer. I'm in charge of the integration and that includes using Visual Studio to generate the ".dll" file, so I had to learn how to do that. I think I'm doing it correctly, I'm including all the files that are required according to my coworker (the C developer) so the ".dll" generation seems to have been successful. But the problem takes place with the System.loadLibrary() method, as I described.
Thanks in advance,
Brian
Wed, 07/13/2016 - 07:18
Hello Brian,
We have sent to you a personal message about our Advanced Java Wrapper tool - please, check your mailbox.
Best regards,
Forum supervisor
Sun, 07/31/2016 - 20:15
Hi, I have the same problem.
Wed, 08/10/2016 - 09:44
Hello Brian,
I am in a similar situation - I have to call the OCCT libs from Java. Here are my answers to your questions:
How can I know exactly what files are missing when I get the Java exception java.lang.UnsatisfiedLinkError?
How can I know exactly what are ALL the libraries what are "missing"? Are those DLLs, or maybe something else?
Where do I get all those missing files from?
Where do I have to place all those missing files, how do I tell Java/JNI where they are? I'm already using this to tell Java/JNI where is the main ".dll" file and it works: -Djava.library.path="(Windows path)"
I hope, it will help. Good luck! Petr