依赖 – Osgi将不匹配bundle内的本机代码
发布时间:2020-12-14 04:47:34 所属栏目:百科 来源:网络整理
导读:我正在尝试使用具有本机代码依赖性的某个 Eclipse插件.这些依赖项总是无法解决,所以这个插件永远不会被OSGI加载. MANIFEST.MF Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: PROS Cortex Flash Utility Bundle-SymbolicName: com.purduesig
我正在尝试使用具有本机代码依赖性的某个
Eclipse插件.这些依赖项总是无法解决,所以这个插件永远不会被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 dll的路径是包jar内的/libs/windows/jSSC-2.6_x86_64.dll.我尝试了许多不同的东西来尝试让本机加载,但没有成功. 如何让OSGI加载本机库?我在Windows 10上运行JRE 8 64位. 编辑: 我这样修改了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.co re.resources,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: .,platform.jar 解决方法
在我的例子中,在将JRE从1.8.0.5更新到1.8.0.162之后,有一个RCP应用程序在DLL上停止了UnsatisfiedLinkError.经过一些搜索,我发现有两个错误,one in Java和
one in OSGi,在Windows 10下的Bundle-NativeCode指令中使用win32别名时相互取消.在更新之前它的工作原因是,Java会掉线如果它不知道Windows返回的版本,则返回默认值. OSGi和
matched with the win32 alias都知道这种后退.
现在更新Java意味着不再使用默认值,而是使用“Windows 10”.但是,前Luna版本的OSGi不知道Windows 10,因此与win32别名不匹配. 我使用的解决方法是相应地覆盖org.osgi.framework.os.name属性,这是可行的,因为该应用程序没有其他目标: -Dorg.osgi.framework.os.name=win32 在大多数情况下,更好的解决方案是将OSGi更新到至少3.10.0. 当然,像作者那样将“Windows 10”作为附加的os.name添加到Manifest中也可以.我决定反对这一点,因为我在依赖项中有几个这样的原生二进制文件,这些文件不在我的控制之下. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |