RCP and JNI lib [message #446507] |
Tue, 21 March 2006 13: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 #446520 is a reply to message #446507] |
Tue, 21 March 2006 17:39 |
Eclipse User |
|
|
|
Originally posted by: jean-philippe.shields.nurun.com
I had a similar problem some time ago. Te solution was that my normal
java application didn't had a package anem but my RCP application had
one. Your JNI function declaration must also have the package name
before your class name. Adding it resolved my problem.
b.h@stud.uni-goettingen.de (=?iso-8859-15?Q?Bj=F6rn?=) wrote in
news:f8f57133a6d3b59da9d5f5f1a214b17a$1@www.eclipse.org:
> 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
|
|
|
Re: RCP and JNI lib [message #446644 is a reply to message #446520] |
Wed, 22 March 2006 16:39 |
Eclipse User |
|
|
|
Originally posted by: b.h.stud.uni-goettingen.de
At first, thank you for help!!
I am sorry to say that doesn't work. I have generate with Eclipse a
RCP-Application. After that I put the JNI Java File (this file had the
nativ calls an the system.load.library call) in to the package from my RCP
Application. Then I put the *.so File in the root directory from my RCP
Application. Now when I compile the Projekt it works. The problems come
with the first call to *.so File.
Where is the mistake? My simple Java Application didn't have a package.
Now in the new Application, I have put the package name in the JNI Java
File, but i don't have generate the *.so new.
When I make a package in my simple Java Application I think I make a
mistake, because the simple Java Application doesn't work.
What can I do to make it that it works? Sorry for my very bad english, but
I hope you can understand me.
Best regards
Björn
|
|
|
|
|
|
Re: RCP and JNI lib [message #446668 is a reply to message #446648] |
Thu, 23 March 2006 09:37 |
Eclipse User |
|
|
|
Originally posted by: b.h.stud.uni-goettingen.de
Hello,
thanks for the introduction, but I don't unterstand. I have following
folder structur.
(Projektname is "Versuch")
Versuch/
-src/
versuch/ (package)
Application.java
ApplicationActionBarAdvisor.java
....
Perspective.java
jllcf.java
-jllcf/
libjllcflib.so
-META-INF/
MANIFEST.MF
-plugin.properites
-plugin.xml
-....
-versuch.product
I copied the jllcf.java from my old simple Java application in to the
folder /src/versuch/ in my new RCP application. After that I generate a
new folder jllcf in the Projekt folder an copied the libjllcflib.so from
my old applicaton in to this folder. And then I have modified the
MANIFEST.MF
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Versuch Plug-in
Bundle-SymbolicName: Versuch; singleton:=true
Bundle-Version: 1.0.0
Bundle-ClassPath: versuch.jar
Bundle-Activator: versuch.VersuchPlugin
Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.ui.forms
Bundle-NativeCode:
jllcflib/libjllcflib.so;
osname=Linux; processor=x86
Eclipse-AutoStart: true
But it doesn't work. I started with RCP and Eclipe for two weeks. Before I
build simple Java application with the JBuilder. Whats wrong with my
application? What have I forgotten or make wrong.
|
|
|
Re: RCP and JNI lib [message #446674 is a reply to message #446668] |
Thu, 23 March 2006 12:42 |
|
Björn wrote:
>
> I copied the jllcf.java from my old simple Java application in to the
> folder /src/versuch/ in my new RCP application. After that I generate a
> new folder jllcf in the Projekt folder an copied the libjllcflib.so from
> my old applicaton in to this folder. And then I have modified the
> MANIFEST.MF
First of all, did you update your jllcf.java file to be in the versuch
package? Then regenerate your JNI headers and re-compile your
libjllcflib.so native lib?
> Bundle-NativeCode: jllcflib/libjllcflib.so;
> osname=Linux; processor=x86
> Eclipse-AutoStart: true
Second, you said you created a jllcf folder but you've listed jllcflib
folder here? Just a transcribe error?
Third, does the directory structure of the exported plugin look like
what Stepan and I have mentioned? It's the deployed one that will matter.
Later,
PW
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
|
|
|
Re: RCP and JNI lib [message #446759 is a reply to message #446674] |
Thu, 23 March 2006 13:43 |
Eclipse User |
|
|
|
Originally posted by: b.h.stud.uni-goettingen.de
Thank you that trying to help me!!!!
Ok, now I have generate a new header file from the jllcf.java file with
the package. Then I build a new C File. After that I generate a new *.so
file. This file copied in the jllcflib folder (it was here a typing
mistake).
Now I exported the Projekt. Till now I was thinking you mean the folder
structure in Eclipse :-( Sorry!!
Eclipse generate fowlling folder structur by export
plugins/
Versuch_1.0.0/
jllcflib/
libjllcflib.so
META-INF/
MANIFEST.MF
plugin.xml
versuch.jar
(In versuch.jar are all *.class files included)
At first the jllcflib folder was not exported, but after that I selected
it in Eclipse and now I have this folder structure. But it still doesn't
work. Why you want see the folder structure from the plugin export? And
now ??? :-(
Gruß
Björn
|
|
|
Re: RCP and JNI lib [message #446784 is a reply to message #446759] |
Fri, 24 March 2006 10:11 |
Eclipse User |
|
|
|
Originally posted by: b.h.stud.uni-goettingen.de
Hello,
I have found the mistake!
Tanks a lot at all people that help me !!!!
Best regards
Björn
|
|
|
|
Re: RCP and JNI lib [message #446789 is a reply to message #446785] |
Fri, 24 March 2006 11:32 |
Eclipse User |
|
|
|
Originally posted by: b.h.stud.uni-goettinge.de
The main problem was that I have no package in my JNI Java File. I have
then put the JNI Java file in an package. I generate a new header,
c-source an *.so file. The Problem was I copied the source from the old
C-File (without a package) and modified only the methods like in the new
header File. Actually no problem, but there must be any thing wrong by the
copy and paste. Now I have copied the new delcaration from the new header
file in to a new C File. The lines in the source code from the dont't
working C File and my new C-File are absolut the same. I don't now were
the mistake is. I only know it was a very silly mistake.
Steps to integrate a own JNI LIB to RCP Application:
1. Put your JNI Java File in to the Application.
2. Generate with javah your header file.
3. Build the C-File an generate the *.so or *.dll file
3. Create a new Folder in your Projekt and put the *.so file in there.
4. Modified your MANIFEST.MF
I think that's it.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03869 seconds