Reputation: 950
I am trying to use a certain Eclipse Plugin that has native code dependencies. These dependencies always go unresolved, so this plugin never gets loaded by OSGI.
MANIFEST.MF
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: PROS Cortex Flash Utility
Bundle-SymbolicName: com.purduesigbots.vexflash; singleton:=true
Bundle-Version: 1.0.0.6
Bundle-Activator: com.purduesigbots.vexflash.Activator
Bundle-Vendor: Purdue ACM SIG BOTS
Require-Bundle: org.eclipse.ui,org.eclipse.core.runtime,org.eclipse.co
re.resources,org.eclipse.ui.ide;bundle-version="3.7.0",org.eclipse.de
bug.ui;bundle-version="3.7.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Bundle-NativeCode:
/libs/windows/jSSC-2.6_x86_64.dll;
osname=win32; processor=x86_64, *
Bundle-ClassPath: .,jna.jar,platform.jar
The path of the dll is /libs/windows/jSSC-2.6_x86_64.dll inside of the bundle jar. I've tried many different things to try to get the native to load, without success.
How can I get OSGI to load the native library? I am running JRE 8 64 bit on Windows 10.
EDIT:
I modified MANIFEST.MF like so to make it work
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: PROS Cortex Flash Utility
Bundle-SymbolicName: com.purduesigbots.vexflash; singleton:=true
Bundle-Version: 1.0.0.6
Bundle-Activator: com.purduesigbots.vexflash.Activator
Bundle-Vendor: Purdue ACM SIG BOTS
Require-Bundle: org.eclipse.ui,org.eclipse.core.runtime,org.eclipse.co
re.resources,org.eclipse.ui.ide;bundle-version="3.7.0",org.eclipse.de
bug.ui;bundle-version="3.7.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Bundle-NativeCode:
#The OS name is not in OS aliases for OSGI, so the full name must be used
/libs/windows/jSSC-2.6_x86_64.dll;
osname=win32; osname="Windows 10"; processor=x86_64
Bundle-ClassPath: .,jna.jar,platform.jar
Upvotes: 4
Views: 1937
Reputation: 1639
In my case, there was a RCP application that stopped with an UnsatisfiedLinkError on a DLL, after updating the JRE from 1.8.0.5 to 1.8.0.162. After some searching, I discovered that there were two bugs, one in Java, and one in OSGi, that cancelled each other out when using the win32 alias in the Bundle-NativeCode instruction under Windows 10. The reason it worked before the update was, that Java would fall back to a default, in case it did not know the version returned by Windows. That fallback was known to OSGi, and matched with the win32 alias. Now updating Java meant that the default would no longer be used, but "Windows 10" instead. However, pre-Luna versions of OSGi did not know Windows 10, and hence did not match it with the win32 alias.
The workaround I went with was, overriding the org.osgi.framework.os.name property accordingly, which was viable because there was no other target for that application:
-Dorg.osgi.framework.os.name=win32
A better solution in most cases would be to update OSGi to at least 3.10.0.
Of course, adding "Windows 10" as an additional os.name to the Manifest as the author did, works as well. I decided against that, because I had several such native binaries in dependencies, which were not under my control.
Upvotes: 2