<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.2.1" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Writing an Eclipse plug-in that uses native code via JNI</title>
	<link>http://www.macrobug.com/blog/2006/12/18/writing-an-eclipse-plug-in-that-uses-native-code-via-jni/</link>
	<description>Macrobug Blog</description>
	<pubDate>Wed, 07 Jan 2009 00:11:41 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.1</generator>

	<item>
		<title>By: Kristina</title>
		<link>http://www.macrobug.com/blog/2006/12/18/writing-an-eclipse-plug-in-that-uses-native-code-via-jni/#comment-23534</link>
		<author>Kristina</author>
		<pubDate>Thu, 24 Jan 2008 01:44:31 +0000</pubDate>
		<guid>http://www.macrobug.com/blog/2006/12/18/writing-an-eclipse-plug-in-that-uses-native-code-via-jni/#comment-23534</guid>
		<description>Yes, when I debug I fail when trying to call the DLL function not when loading.  Someone suggested adding... 
Bundle-NativeCode: libparser.dll;osname=win32;processor=x86
to the header of MANIFEST.MF.  However, it didn't make any difference when I ran my code.  Have you used Bundle-NativeCode?

And yeah the code example difference was a typo.</description>
		<content:encoded><![CDATA[<p>Yes, when I debug I fail when trying to call the DLL function not when loading.  Someone suggested adding&#8230;<br />
Bundle-NativeCode: libparser.dll;osname=win32;processor=x86<br />
to the header of MANIFEST.MF.  However, it didn&#8217;t make any difference when I ran my code.  Have you used Bundle-NativeCode?</p>
<p>And yeah the code example difference was a typo.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adrian Taylor</title>
		<link>http://www.macrobug.com/blog/2006/12/18/writing-an-eclipse-plug-in-that-uses-native-code-via-jni/#comment-23483</link>
		<author>Adrian Taylor</author>
		<pubDate>Wed, 23 Jan 2008 12:28:53 +0000</pubDate>
		<guid>http://www.macrobug.com/blog/2006/12/18/writing-an-eclipse-plug-in-that-uses-native-code-via-jni/#comment-23483</guid>
		<description>Hi, no specific answers. But it looks like it's failing when it's trying to call the DLL function rather than when it's loading the DLL. Maybe you changed the package name or something else which affects the name of the symbol it needs to call?
Also from your code example, it is trying to call Interface.open_file but your native method is ced_open_file</description>
		<content:encoded><![CDATA[<p>Hi, no specific answers. But it looks like it&#8217;s failing when it&#8217;s trying to call the DLL function rather than when it&#8217;s loading the DLL. Maybe you changed the package name or something else which affects the name of the symbol it needs to call?<br />
Also from your code example, it is trying to call Interface.open_file but your native method is ced_open_file</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kristina</title>
		<link>http://www.macrobug.com/blog/2006/12/18/writing-an-eclipse-plug-in-that-uses-native-code-via-jni/#comment-23406</link>
		<author>Kristina</author>
		<pubDate>Tue, 22 Jan 2008 23:00:02 +0000</pubDate>
		<guid>http://www.macrobug.com/blog/2006/12/18/writing-an-eclipse-plug-in-that-uses-native-code-via-jni/#comment-23406</guid>
		<description>I created a Java project in Eclipse referencing a DLL and everything ran properly.  In Interface.java I declared the native functions, ie:
public native int ced_open_file(String filename);
.... 

static {
        System.loadLibrary("libparser.dll");
    }

Test.java contains the main program.  

I moved the same files in a Plug-in project.  I added libparser.dll to the root and added it to build.properties. I get the error: 

java.lang.UnsatisfiedLinkError: myplugin/Interface.open_file
	at myplugin.Interface.open_file(Ljava.lang.String;)I(Interface.java:???)
	at myplugin.Test.main(Test.java:29)

I have also changed System.load to System.loadLibrary(exact path to dll) and added the path to the VM arguments using -Djava.library.path.  I get the same error.  

Have any suggestions to why it works as a Java Project but not as a plug-in?</description>
		<content:encoded><![CDATA[<p>I created a Java project in Eclipse referencing a DLL and everything ran properly.  In Interface.java I declared the native functions, ie:<br />
public native int ced_open_file(String filename);<br />
&#8230;. </p>
<p>static {<br />
        System.loadLibrary(&#8221;libparser.dll&#8221;);<br />
    }</p>
<p>Test.java contains the main program.  </p>
<p>I moved the same files in a Plug-in project.  I added libparser.dll to the root and added it to build.properties. I get the error: </p>
<p>java.lang.UnsatisfiedLinkError: myplugin/Interface.open_file<br />
	at myplugin.Interface.open_file(Ljava.lang.String;)I(Interface.java:???)<br />
	at myplugin.Test.main(Test.java:29)</p>
<p>I have also changed System.load to System.loadLibrary(exact path to dll) and added the path to the VM arguments using -Djava.library.path.  I get the same error.  </p>
<p>Have any suggestions to why it works as a Java Project but not as a plug-in?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: www.macrobug.com&#187; Blog Archive &#187; Linking to Windows API DLLs from mingw</title>
		<link>http://www.macrobug.com/blog/2006/12/18/writing-an-eclipse-plug-in-that-uses-native-code-via-jni/#comment-104</link>
		<author>www.macrobug.com&#187; Blog Archive &#187; Linking to Windows API DLLs from mingw</author>
		<pubDate>Wed, 10 Jan 2007 18:28:20 +0000</pubDate>
		<guid>http://www.macrobug.com/blog/2006/12/18/writing-an-eclipse-plug-in-that-uses-native-code-via-jni/#comment-104</guid>
		<description>[...] I thought I had it all cracked when I managed to link to one of my DLLs from within an Eclipse plug-in. Today I wanted to do the same thing, with the only difference being that the DLL is a Microsoft one. [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] I thought I had it all cracked when I managed to link to one of my DLLs from within an Eclipse plug-in. Today I wanted to do the same thing, with the only difference being that the DLL is a Microsoft one. [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: www.macrobug.com&#187; Blog Archive &#187; Debugging JNI Eclipse plug-ins</title>
		<link>http://www.macrobug.com/blog/2006/12/18/writing-an-eclipse-plug-in-that-uses-native-code-via-jni/#comment-93</link>
		<author>www.macrobug.com&#187; Blog Archive &#187; Debugging JNI Eclipse plug-ins</author>
		<pubDate>Thu, 04 Jan 2007 10:31:24 +0000</pubDate>
		<guid>http://www.macrobug.com/blog/2006/12/18/writing-an-eclipse-plug-in-that-uses-native-code-via-jni/#comment-93</guid>
		<description>[...] Previously I explained how to create a JNI plug-in for Eclipse, from Eclipse. [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] Previously I explained how to create a JNI plug-in for Eclipse, from Eclipse. [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adrian Taylor</title>
		<link>http://www.macrobug.com/blog/2006/12/18/writing-an-eclipse-plug-in-that-uses-native-code-via-jni/#comment-55</link>
		<author>Adrian Taylor</author>
		<pubDate>Mon, 18 Dec 2006 19:40:30 +0000</pubDate>
		<guid>http://www.macrobug.com/blog/2006/12/18/writing-an-eclipse-plug-in-that-uses-native-code-via-jni/#comment-55</guid>
		<description>And here's an equivalent makefile that works under Carbide.

&lt;pre class="code"&gt;
all : testjniplugin.dll

testjniplugin.dll : nativesrc/SampleAction.c exampleJNI_actions_SampleAction.h
	mwccsym2 -I. -o SampleAction.obj nativesrc/SampleAction.c \\
		-I- "-Ic:\\Program Files\\Java\\jdk1.5.0_09\include" \\
		"-Ic:\Program Files\Java\jdk1.5.0_09\include\win32" \\
		-msgstyle parseable -c
	mwldsym2 -shared -o testjniplugin.dll SampleAction.obj

exampleJNI_actions_SampleAction.h : bin/exampleJNI/actions/SampleAction.class
	"c:\\Program Files\\Java\\jdk1.5.0_09\\bin\\javah" -classpath bin -jni exampleJNI.actions.SampleAction 

clean :
	-del examplejni_actions_SampleAction.h
	-del testjniplugin.dll
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>And here&#8217;s an equivalent makefile that works under Carbide.</p>
<pre class="code">
all : testjniplugin.dll

testjniplugin.dll : nativesrc/SampleAction.c exampleJNI_actions_SampleAction.h
	mwccsym2 -I. -o SampleAction.obj nativesrc/SampleAction.c \
		-I- "-Ic:\Program Files\Java\jdk1.5.0_09include" \
		"-Ic:Program FilesJavajdk1.5.0_09includewin32" \
		-msgstyle parseable -c
	mwldsym2 -shared -o testjniplugin.dll SampleAction.obj

exampleJNI_actions_SampleAction.h : bin/exampleJNI/actions/SampleAction.class
	"c:\Program Files\Java\jdk1.5.0_09\bin\javah" -classpath bin -jni exampleJNI.actions.SampleAction 

clean :
	-del examplejni_actions_SampleAction.h
	-del testjniplugin.dll
</pre>
]]></content:encoded>
	</item>
</channel>
</rss>
