

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
4 messages in net.java.dev.jna.usersRe: [jna-users] jna and eclipse plugins| From | Sent On | Attachments |
|---|---|---|
| andrea antonello | Jul 26, 2008 3:06 am | |
| Timothy Wall | Jul 27, 2008 8:06 pm | |
| andrea antonello | Jul 28, 2008 1:10 am | |
| Timothy Wall | Jul 28, 2008 4:47 am |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | Re: [jna-users] jna and eclipse plugins | Actions... |
|---|---|---|
| From: | Timothy Wall (twal...@dev.java.net) | |
| Date: | Jul 27, 2008 8:06:28 pm | |
| List: | net.java.dev.jna.users | |
JNA uses jna.library.path to find explicitly loaded libraries only. It does not affect the system search path (aka java.library.path), so if dependent libraries are not on the system search path, they will not be found.
Eclipse likely adds the plugin root to the system search path.
On Jul 26, 2008, at 6:06 AM, andrea antonello wrote:
Hi list, I hope this is the right list to use. I am using jna in eclipse rcp environment and are having some odd problem with Unsatisfied links. I want to share my experience and hope to be able to complete the picture with some other's experience.
I am calling a fortran algorithm from java, i.e. I pass through a C wrapper with which I use jna.
To better understand I will give names. My shared library is called libkriging.so. The fortran code is currently compiled with intels ifort and therefore libkriging.so depends on libifcore.so which again depends on libimf.so.
I created the interface: public interface KrigingLibrary extends Library {
KrigingLibrary imf = (KrigingLibrary) Native.loadLibrary("imf", //$NON-NLS-1$ KrigingLibrary.class); KrigingLibrary ifcore = (KrigingLibrary) Native.loadLibrary("ifcore", //$NON-NLS-1$ KrigingLibrary.class); KrigingLibrary INSTANCE = (KrigingLibrary) Native.loadLibrary("kriging", //$NON-NLS-1$ KrigingLibrary.class); [...]
Inside which I load in inverse dependency order the needed libs. I assume this is the way to go.
Through the System.setProperty("jna.library.path", newLibraryPath); directive I set the path to both the kriging library folder and the ifort libs folder.
The kriging lib is placed in the root of the plugin, which is the place where the rcp environment searches for native libs by default.
This works like a charm. And this is my experience.
Now the thing I do not understand :)
If I place the kriging lib inside a folder (ex. native) inside the plugin, i.e. I move the lib from the plugin root and supply to jna.library.path the new <plugin>/native folder, I get an unsatisfied link exception, even if the path is correctly set in the jna.library.path.
My feeling is that this behaviour is due to an eclipse imposition, but perhaps someone else has some different experience. My feeling is that: 1) it doesn't make sense to set jna.library.path for libs inside the plugin, which instead have to be placed in the plugin root. 2) for external libs the jna.library.path setting works.
Any comment?
Best regards, Andrea







