Comments on: JNI (Java Native Interface): Exception in thread “main” java.lang.UnsatisfiedLinkError: Can’t find dependent libraries http://witte-consulting.com/blog/jni-java-native-interface-exception-in-thread-main-javalangunsatisfiedlinkerror-can-t-find-dependent-libraries/ Brief articles by Kai Witte Sun, 28 May 2017 08:52:01 +0000 hourly 1 https://wordpress.org/?v=4.9.7 By: 如何修复了UnsatisfiedLinkError错误(可以与# 39;找不到依赖库)在JNI项目 – CodingBlog http://witte-consulting.com/blog/jni-java-native-interface-exception-in-thread-main-javalangunsatisfiedlinkerror-can-t-find-dependent-libraries/comment-page-1/#comment-829 Sun, 28 May 2017 08:52:01 +0000 http://witte-consulting.com/blog/?p=141#comment-829 […] fixed the method names in mylib.dll, as suggested here. The method names had somehow gotten mangled by the compiler, but I added linker flags and the dll […]

]]>
By: vivek http://witte-consulting.com/blog/jni-java-native-interface-exception-in-thread-main-javalangunsatisfiedlinkerror-can-t-find-dependent-libraries/comment-page-1/#comment-799 Sun, 15 Jul 2012 18:33:11 +0000 http://witte-consulting.com/blog/?p=141#comment-799 -Wl, –kill-at OR -Wl,–add-stdcall-alias worked for me

Thank you SO much for your help kai W

]]>
By: Prahalad Das http://witte-consulting.com/blog/jni-java-native-interface-exception-in-thread-main-javalangunsatisfiedlinkerror-can-t-find-dependent-libraries/comment-page-1/#comment-793 Tue, 12 Jun 2012 14:27:18 +0000 http://witte-consulting.com/blog/?p=141#comment-793 All thanks to you, i am able to run my first jni java after 11 years working in java & i used to give up in between and never used to work so hard to look for solution and used to stick with java alone.

Thanks to you solution
-Wl,–add-stdcall-alias -mno-cygwin

It did the all the magic, thanks for this kind blog.

]]>
By: Dhiral http://witte-consulting.com/blog/jni-java-native-interface-exception-in-thread-main-javalangunsatisfiedlinkerror-can-t-find-dependent-libraries/comment-page-1/#comment-792 Sun, 10 Jun 2012 09:23:01 +0000 http://witte-consulting.com/blog/?p=141#comment-792 thanks a lot
i generate .dll files using GCC but it’s create problem like
java.lang.UnsatisfiedLinkError

But then i used TCC (Tiny C compiler ) and generate .dll and it’s works for me……..

]]>
By: javarevisited http://witte-consulting.com/blog/jni-java-native-interface-exception-in-thread-main-javalangunsatisfiedlinkerror-can-t-find-dependent-libraries/comment-page-1/#comment-780 Sun, 11 Mar 2012 11:28:16 +0000 http://witte-consulting.com/blog/?p=141#comment-780 Nice tutorial and thanks for sharing information. I have also share my view as How to fix java.lang.unsatisfiedLinkError in java let me know how do you find it.

]]>
By: Jigar Thakkar http://witte-consulting.com/blog/jni-java-native-interface-exception-in-thread-main-javalangunsatisfiedlinkerror-can-t-find-dependent-libraries/comment-page-1/#comment-772 Sun, 12 Feb 2012 07:50:26 +0000 http://witte-consulting.com/blog/?p=141#comment-772 Alexandra Niculai and degree are correct, deleting the -MD from the command works perfect thank you.

]]>
By: Hari http://witte-consulting.com/blog/jni-java-native-interface-exception-in-thread-main-javalangunsatisfiedlinkerror-can-t-find-dependent-libraries/comment-page-1/#comment-771 Sun, 12 Feb 2012 05:01:34 +0000 http://witte-consulting.com/blog/?p=141#comment-771 Thanks Alexandra,
Yes, removing the -MD make it work for me! I am sure you know why by now. Could you pl. share it in this forum?

Regards … Hari

]]>
By: Mark M http://witte-consulting.com/blog/jni-java-native-interface-exception-in-thread-main-javalangunsatisfiedlinkerror-can-t-find-dependent-libraries/comment-page-1/#comment-718 Fri, 27 May 2011 04:56:28 +0000 http://witte-consulting.com/blog/?p=141#comment-718 I have a probable solution for anyone getting this error when working with Eclipse! If you are loading your dll file as a resource into your system classloader, then you absolutely must do a project–>clean every single time you update your dll!! Even restarting eclipse or your computer won’t clear the old dll resource from your classloader. Tracking that one down was incredibly painful!

]]>
By: Daniel http://witte-consulting.com/blog/jni-java-native-interface-exception-in-thread-main-javalangunsatisfiedlinkerror-can-t-find-dependent-libraries/comment-page-1/#comment-717 Mon, 16 May 2011 18:25:12 +0000 http://witte-consulting.com/blog/?p=141#comment-717 Idk if this will help anyone, but I’m using C++ compiling with VS win64 2010 command prompt.
I used the -MD option suggested fix and it did not affect my link problem.
I since my code was written in C++ I had modified my JNI header file code and removed this code:
“#ifdef __cplusplus
extern “C” {
#endif

//Method prototypes

#ifdef __cplusplus
}
#endif”
Obviously I’m not very clever. Once I put this code back in and ran the dumpbin tool (thanks to whoever mentioned that first) I got a perfect looking signatures.
This solved my linking issue.

]]>
By: anandhrds http://witte-consulting.com/blog/jni-java-native-interface-exception-in-thread-main-javalangunsatisfiedlinkerror-can-t-find-dependent-libraries/comment-page-1/#comment-716 Thu, 05 May 2011 08:07:12 +0000 http://witte-consulting.com/blog/?p=141#comment-716 Thanks for all the members in this post….
If you are using gcc complier, then add “-Wl,-kill-at” as one of the argument to gcc, This will solve the problem.
So, for example, in my case the command looks like this
“-Wl,-kill-at” -shared HelloWorld.c “-Ic:\Program Files\Java\jdk1.6.0_02\include” “-Ic:\Program Files\Java\jdk1.6.0_02\include\win32” -o ${workspace_loc:/JNISampleJava/bin}\HelloWorld.dll

]]>