Eclipse RCP support

Please can you provide an example of how to integrate with Eclipse RCP which uses OSGI to manage dependencies

Hey Cathy,

The best place to start is our Java example: https://wyday.com/limelm/help/using-turboactivate-with-java/

It works in IntelliJ, Netbeans, and Eclipse. The article talks all about the dependencies (JNA and TurboActivate) and how to distribute them with your app.

If after reading and working through the example you still have questions we'll be happy to help.

I have read that. I have created a plugin to wrap the native libraries. I am then calling SetTurboActivateFolder(..) to set the path to plugin folder.

This works fine when it is running as an Eclipse Application.

However when I build it as an RCP product, the native libraries are bundled into the plugin jar. When jna tries to load them the path is actually a jar file;-

...a_file_path..1706121238.jar!/mac/librlm1222.dylib

and jna throws an error.

Caused by: java.lang.IllegalArgumentException: name too long at java.lang.System.mapLibraryName(Native Method) at com.sun.jna.NativeLibrary.mapSharedLibraryName(NativeLibrary.java:730) at com.sun.jna.NativeLibrary.findLibraryPath(NativeLibrary.java:692) at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:180) at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:427) at com.sun.jna.Library$Handler.<init>(Library.java:179) at com.sun.jna.Native.loadLibrary(Native.java:569) at com.sun.jna.Native.loadLibrary(Native.java:544)

The standard way of loading native libraries with OSGi is to use jni and Bundle-NativeCode in the manifest.

Any ideas?

Just done a little more digging and it looks as if I won't be able to load the TurboNative library directly from a jar file. Instead I should extract the library file and put it in a temporary location. Then set the location.

Is that correct? Will this work as a workaround? Is anyone else doing this?

From what I've read that seems the way to do things. There seems to be very little information about JNA and OSGI, other than it's supported.