RCP and JNI lib [message #446507] |
Tue, 21 March 2006 08:58  |
Eclipse User |
|
|
|
Originally posted by: b.h.stud.uni-goettingen.de
Hello,
I have a question about RCP and JNI.
I want to call a JNI from my RCP Application. My JNI works with a normal
Java Application without problems. Now I want to use this JNI with my new
RCP Application. But it doesn't work.
When I try to get access to the JNI, I get this error:
Unhandled event loop exception
Reason:
javaCanSocketCreate
JavaCanSocketCreate is a Methode in my JNI.
Best regards
Björn
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: RCP and JNI lib [message #461627 is a reply to message #446648] |
Sun, 14 January 2007 11:28  |
Eclipse User |
|
|
|
I tried packaging a JNI project into a plugin and had some problems with
link errors at the beginning. I discovered a few things that were not
obvious from the posts I was reading:
- Making an entry in the Manifest.mf using "Bundle-NativeCode:" was
necessary. Otherwise the dlls were not being found.
- It seemed necessary to include the processor and osname elements when
describing the Bundle-NativeCode. When I left them out, the RCP app would
not start and an exception was thrown "org.osgi.framework.BundleException:
No Bundle-NativeCode match"
- So in the end it looked like this
Bundle-NativeCode: environment/c.dll; environment/b.dll;
environment/a.dll; processor="x86"; osname="WindowsXP"
That is copy and pasted from my working manifest. Note the semi-colons! I
had seen some posts were people claimed this should be commas. That seems
to be true when you are separating library versions for different os's,
but when you are including multiple dlls for one os, the dll "folder+name"
stringsneed to be seperated by semi-colons. If you get this wrong, eclipse
findas the last dll in the list but not the previous ones and does not
complain about the syntax.
- I included the dlls in order of their dependence on each other (leaf
first in a dependence tree. I used Dependency Walker
(http://www.dependencywalker.com/) to figure out this order. I don't know
if the order was necessary in the manifest. It is necessary when you start
calling System.LoadLibrary, otherwise Windows does not finde the dependent
libs.
- The PDE FAQ qas helpful in solving these issues.
http://eclipsewiki.editme.com/PDEFaq
- Here is the Syntax for Bundle-NativeCode (showing when to use commas, and
when to use semi-colons!)
http://www.koders.com/java/fid7123785AF3DDA5593BB01D469942C0 B85EF789DA.aspx
Bundle-NativeCode: nativecode-clause ( , nativecode-clause)*
nativecode-clause: nativepaths ( ; env-parameter )*
nativepaths: nativepath ( ;nativepath )*
env-parameter: ( processordef | osnamedef | osversiondef |languagedef )
processordef: <I>processor= </I>token
osnamedef: <I>osname=</I>token
osversiondef: <I>osversion= </I>token
languagedef: <I>language=</I>token
I hope that helps someone. I spent much too long searching about in
newsgroups before this finally worked.....
|
|
|
Powered by
FUDForum. Page generated in 0.05143 seconds