<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: JNI (Java Native Interface): Exception in thread &#8220;main&#8221; java.lang.UnsatisfiedLinkError: Can&#8217;t find dependent libraries</title>
	<atom:link href="http://witte-consulting.com/blog/jni-java-native-interface-exception-in-thread-main-javalangunsatisfiedlinkerror-can-t-find-dependent-libraries/feed/" rel="self" type="application/rss+xml" />
	<link>http://witte-consulting.com/blog/jni-java-native-interface-exception-in-thread-main-javalangunsatisfiedlinkerror-can-t-find-dependent-libraries/</link>
	<description>Brief articles by Kai Witte</description>
	<lastBuildDate>Tue, 10 Jan 2012 17:42:24 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Mark M</title>
		<link>http://witte-consulting.com/blog/jni-java-native-interface-exception-in-thread-main-javalangunsatisfiedlinkerror-can-t-find-dependent-libraries/comment-page-1/#comment-718</link>
		<dc:creator>Mark M</dc:creator>
		<pubDate>Fri, 27 May 2011 04:56:28 +0000</pubDate>
		<guid isPermaLink="false">http://witte-consulting.com/blog/?p=141#comment-718</guid>
		<description>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--&gt;clean every single time you update your dll!! Even restarting eclipse or your computer won&#039;t clear the old dll resource from your classloader. Tracking that one down was incredibly painful!</description>
		<content:encoded><![CDATA[<p>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&#8211;&gt;clean every single time you update your dll!! Even restarting eclipse or your computer won&#8217;t clear the old dll resource from your classloader. Tracking that one down was incredibly painful!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel</title>
		<link>http://witte-consulting.com/blog/jni-java-native-interface-exception-in-thread-main-javalangunsatisfiedlinkerror-can-t-find-dependent-libraries/comment-page-1/#comment-717</link>
		<dc:creator>Daniel</dc:creator>
		<pubDate>Mon, 16 May 2011 18:25:12 +0000</pubDate>
		<guid isPermaLink="false">http://witte-consulting.com/blog/?p=141#comment-717</guid>
		<description>Idk if this will help anyone, but I&#039;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:
&quot;#ifdef __cplusplus
extern &quot;C&quot; {
#endif

//Method prototypes

#ifdef __cplusplus
}
#endif&quot;
Obviously I&#039;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.</description>
		<content:encoded><![CDATA[<p>Idk if this will help anyone, but I&#8217;m using C++ compiling with VS win64 2010 command prompt.<br />
I used the -MD option suggested fix and it did not affect my link problem.<br />
I since my code was written in C++ I had modified my JNI header file code and removed this code:<br />
&#8220;#ifdef __cplusplus<br />
extern &#8220;C&#8221; {<br />
#endif</p>
<p>//Method prototypes</p>
<p>#ifdef __cplusplus<br />
}<br />
#endif&#8221;<br />
Obviously I&#8217;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.<br />
This solved my linking issue.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: anandhrds</title>
		<link>http://witte-consulting.com/blog/jni-java-native-interface-exception-in-thread-main-javalangunsatisfiedlinkerror-can-t-find-dependent-libraries/comment-page-1/#comment-716</link>
		<dc:creator>anandhrds</dc:creator>
		<pubDate>Thu, 05 May 2011 08:07:12 +0000</pubDate>
		<guid isPermaLink="false">http://witte-consulting.com/blog/?p=141#comment-716</guid>
		<description>Thanks for all the members in this post.... 
If you are using gcc complier, then add &quot;-Wl,-kill-at&quot; as one of the argument to gcc, This will solve the problem.
So, for example, in my case the command looks like this
&quot;-Wl,-kill-at&quot; -shared HelloWorld.c  &quot;-Ic:\Program Files\Java\jdk1.6.0_02\include&quot; &quot;-Ic:\Program Files\Java\jdk1.6.0_02\include\win32&quot; -o ${workspace_loc:/JNISampleJava/bin}\HelloWorld.dll</description>
		<content:encoded><![CDATA[<p>Thanks for all the members in this post&#8230;.<br />
If you are using gcc complier, then add &#8220;-Wl,-kill-at&#8221; as one of the argument to gcc, This will solve the problem.<br />
So, for example, in my case the command looks like this<br />
&#8220;-Wl,-kill-at&#8221; -shared HelloWorld.c  &#8220;-Ic:\Program Files\Java\jdk1.6.0_02\include&#8221; &#8220;-Ic:\Program Files\Java\jdk1.6.0_02\include\win32&#8243; -o ${workspace_loc:/JNISampleJava/bin}\HelloWorld.dll</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Oyoqui</title>
		<link>http://witte-consulting.com/blog/jni-java-native-interface-exception-in-thread-main-javalangunsatisfiedlinkerror-can-t-find-dependent-libraries/comment-page-1/#comment-707</link>
		<dc:creator>Oyoqui</dc:creator>
		<pubDate>Wed, 23 Mar 2011 15:56:44 +0000</pubDate>
		<guid isPermaLink="false">http://witte-consulting.com/blog/?p=141#comment-707</guid>
		<description>I have the same error and can fix it.

I make an JNI example and everithing works fine then I add that code (the same code and the same DLL) to my project and it don&#039;t work it send me the same error that yours.

Then I check that the only modification was that I add the package instruction in my java code. I google it and see that I need to change the name of all my C methods to contain the new path of mi java files. You can use:

javah -jni MiJavaClass

and  compare the generated .h file with your actual C code and if it is differente change it and create the new DLL and try to access it.</description>
		<content:encoded><![CDATA[<p>I have the same error and can fix it.</p>
<p>I make an JNI example and everithing works fine then I add that code (the same code and the same DLL) to my project and it don&#8217;t work it send me the same error that yours.</p>
<p>Then I check that the only modification was that I add the package instruction in my java code. I google it and see that I need to change the name of all my C methods to contain the new path of mi java files. You can use:</p>
<p>javah -jni MiJavaClass</p>
<p>and  compare the generated .h file with your actual C code and if it is differente change it and create the new DLL and try to access it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adil</title>
		<link>http://witte-consulting.com/blog/jni-java-native-interface-exception-in-thread-main-javalangunsatisfiedlinkerror-can-t-find-dependent-libraries/comment-page-1/#comment-706</link>
		<dc:creator>Adil</dc:creator>
		<pubDate>Fri, 18 Mar 2011 02:11:11 +0000</pubDate>
		<guid isPermaLink="false">http://witte-consulting.com/blog/?p=141#comment-706</guid>
		<description>Hey gotqn - I got the Solution.

Right Click Project Folder - Go to Properties -&gt; Click C Compiler -&gt; Tool Option and edit as follows: gcc-3.exe -Wl,--add-stdcall-alias, if you are using gcc-3.exe as compiler or just gcc.exe. You need to append &quot;-Wl,--add-stdcall-alias&quot; to the Compiler Tool Option and it wroked. 

Then Clean and Build the Project and use the resultant .dll or .so in the Main.java program. Let me know if it helped:

This resolves the error:
Exception in thread “main” java.lang.UnsatisfiedLinkError: jnidemojava.Main.nativePrint()V
at jnidemojava.Main.nativePrint(Native Method)
at jnidemojava.Main.main(Main.java:22)</description>
		<content:encoded><![CDATA[<p>Hey gotqn &#8211; I got the Solution.</p>
<p>Right Click Project Folder &#8211; Go to Properties -&gt; Click C Compiler -&gt; Tool Option and edit as follows: gcc-3.exe -Wl,&#8211;add-stdcall-alias, if you are using gcc-3.exe as compiler or just gcc.exe. You need to append &#8220;-Wl,&#8211;add-stdcall-alias&#8221; to the Compiler Tool Option and it wroked. </p>
<p>Then Clean and Build the Project and use the resultant .dll or .so in the Main.java program. Let me know if it helped:</p>
<p>This resolves the error:<br />
Exception in thread “main” java.lang.UnsatisfiedLinkError: jnidemojava.Main.nativePrint()V<br />
at jnidemojava.Main.nativePrint(Native Method)<br />
at jnidemojava.Main.main(Main.java:22)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adil</title>
		<link>http://witte-consulting.com/blog/jni-java-native-interface-exception-in-thread-main-javalangunsatisfiedlinkerror-can-t-find-dependent-libraries/comment-page-1/#comment-705</link>
		<dc:creator>Adil</dc:creator>
		<pubDate>Fri, 18 Mar 2011 00:57:01 +0000</pubDate>
		<guid isPermaLink="false">http://witte-consulting.com/blog/?p=141#comment-705</guid>
		<description>My Case is same as gotqn case. I am using the example - &quot;http://netbeans.org/kb/docs/cnd/beginning-jni-linux.html&quot;. I reached till the end but stuck with the exception : 

run:
Exception in thread &quot;main&quot; java.lang.UnsatisfiedLinkError: jnidemojava.Main.nativePrint()V
        at jnidemojava.Main.nativePrint(Native Method)
        at jnidemojava.Main.main(Main.java:22)
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)

Any help is highly appreciated.</description>
		<content:encoded><![CDATA[<p>My Case is same as gotqn case. I am using the example &#8211; &#8220;http://netbeans.org/kb/docs/cnd/beginning-jni-linux.html&#8221;. I reached till the end but stuck with the exception : </p>
<p>run:<br />
Exception in thread &#8220;main&#8221; java.lang.UnsatisfiedLinkError: jnidemojava.Main.nativePrint()V<br />
        at jnidemojava.Main.nativePrint(Native Method)<br />
        at jnidemojava.Main.main(Main.java:22)<br />
Java Result: 1<br />
BUILD SUCCESSFUL (total time: 0 seconds)</p>
<p>Any help is highly appreciated.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gotqn</title>
		<link>http://witte-consulting.com/blog/jni-java-native-interface-exception-in-thread-main-javalangunsatisfiedlinkerror-can-t-find-dependent-libraries/comment-page-1/#comment-702</link>
		<dc:creator>gotqn</dc:creator>
		<pubDate>Mon, 28 Feb 2011 16:19:32 +0000</pubDate>
		<guid isPermaLink="false">http://witte-consulting.com/blog/?p=141#comment-702</guid>
		<description>Because It is a sample for linux, when directories are add, in the sample they are include and linux, but I am using windows XP, so in my java dk there is win32. Could this be a problem? 

Plaase, tell me, what&#039;s the difference between shared object and dll? What is best to be used?</description>
		<content:encoded><![CDATA[<p>Because It is a sample for linux, when directories are add, in the sample they are include and linux, but I am using windows XP, so in my java dk there is win32. Could this be a problem? </p>
<p>Plaase, tell me, what&#8217;s the difference between shared object and dll? What is best to be used?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kai Witte</title>
		<link>http://witte-consulting.com/blog/jni-java-native-interface-exception-in-thread-main-javalangunsatisfiedlinkerror-can-t-find-dependent-libraries/comment-page-1/#comment-701</link>
		<dc:creator>Kai Witte</dc:creator>
		<pubDate>Sun, 27 Feb 2011 17:33:12 +0000</pubDate>
		<guid isPermaLink="false">http://witte-consulting.com/blog/?p=141#comment-701</guid>
		<description>Your dll is not in the PATH, or it has been built wrong. Make sure to use the correct options as described in the blog post to build the dll. Analyse your dll with appropriate tools.

I don&#039;t understand what you are doing with the win32.</description>
		<content:encoded><![CDATA[<p>Your dll is not in the PATH, or it has been built wrong. Make sure to use the correct options as described in the blog post to build the dll. Analyse your dll with appropriate tools.</p>
<p>I don&#8217;t understand what you are doing with the win32.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gotqn</title>
		<link>http://witte-consulting.com/blog/jni-java-native-interface-exception-in-thread-main-javalangunsatisfiedlinkerror-can-t-find-dependent-libraries/comment-page-1/#comment-700</link>
		<dc:creator>gotqn</dc:creator>
		<pubDate>Sun, 27 Feb 2011 17:23:11 +0000</pubDate>
		<guid isPermaLink="false">http://witte-consulting.com/blog/?p=141#comment-700</guid>
		<description>Hi, I am trying to make a sample native method to work but not able till now. I need help to understand what I am doing wrong.

This is the example I am following : http://netbeans.org/kb/docs/cnd/beginning-jni-linux.html

The example is for linux, but I am using windows XP ( In the part of including directories I add win32 from java folder, except linux - I hope this is not the problem).

I do everything from the example good, build without errors, except the last build. It gives me this message:

run:
Exception in thread &quot;main&quot; java.lang.UnsatisfiedLinkError: jnidemojava.Main.nativePrint()V
        at jnidemojava.Main.nativePrint(Native Method)
        at jnidemojava.Main.main(Main.java:20)
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)



and this is the code in my main method (done as in the example)

...

I am using Netbeans IDE 6.9.1

Please, every help will be appreciated. I am stuck with this samples, try about ten different samples from the net, and still have not been made one of them working ... It is important for me to make one of them working because I am new in JNI and reading something like book about it but in the book everything is done in eclipse and to continue with the reading I have to understand how to make the samples there in NetBeans IDE.

Thanks in advance.</description>
		<content:encoded><![CDATA[<p>Hi, I am trying to make a sample native method to work but not able till now. I need help to understand what I am doing wrong.</p>
<p>This is the example I am following : <a href="http://netbeans.org/kb/docs/cnd/beginning-jni-linux.html" rel="nofollow">http://netbeans.org/kb/docs/cnd/beginning-jni-linux.html</a></p>
<p>The example is for linux, but I am using windows XP ( In the part of including directories I add win32 from java folder, except linux &#8211; I hope this is not the problem).</p>
<p>I do everything from the example good, build without errors, except the last build. It gives me this message:</p>
<p>run:<br />
Exception in thread &#8220;main&#8221; java.lang.UnsatisfiedLinkError: jnidemojava.Main.nativePrint()V<br />
        at jnidemojava.Main.nativePrint(Native Method)<br />
        at jnidemojava.Main.main(Main.java:20)<br />
Java Result: 1<br />
BUILD SUCCESSFUL (total time: 0 seconds)</p>
<p>and this is the code in my main method (done as in the example)</p>
<p>&#8230;</p>
<p>I am using Netbeans IDE 6.9.1</p>
<p>Please, every help will be appreciated. I am stuck with this samples, try about ten different samples from the net, and still have not been made one of them working &#8230; It is important for me to make one of them working because I am new in JNI and reading something like book about it but in the book everything is done in eclipse and to continue with the reading I have to understand how to make the samples there in NetBeans IDE.</p>
<p>Thanks in advance.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anand</title>
		<link>http://witte-consulting.com/blog/jni-java-native-interface-exception-in-thread-main-javalangunsatisfiedlinkerror-can-t-find-dependent-libraries/comment-page-1/#comment-699</link>
		<dc:creator>Anand</dc:creator>
		<pubDate>Tue, 22 Feb 2011 14:40:35 +0000</pubDate>
		<guid isPermaLink="false">http://witte-consulting.com/blog/?p=141#comment-699</guid>
		<description>Hi

I am getting Exception in thread &quot;main&quot; java.lang.UnsatisfiedLinkError:
when i try to run a native method accessing a .dll in a Dynamic web Project

But i am able to the same code successfully in a simple java project.

Can any one help me how to get out of this issue.</description>
		<content:encoded><![CDATA[<p>Hi</p>
<p>I am getting Exception in thread &#8220;main&#8221; java.lang.UnsatisfiedLinkError:<br />
when i try to run a native method accessing a .dll in a Dynamic web Project</p>
<p>But i am able to the same code successfully in a simple java project.</p>
<p>Can any one help me how to get out of this issue.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

