我想将一些DLL与相关的本机JNI类分开。
插件:
在运行时,我得到一个UnsatisfiedLinkError,因为找不到JNI类。 我尝试通过更新MANIFEST文件来更新类加载器逻辑:
插件A:
Eclipse-BuddyPolicy: registered
插件B:
Eclipse-RegisterBuddy: A
但这也行不通。 你知道解决方案吗?
编辑:
表示A:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %plugin.name
Bundle-SymbolicName: xxx ;singleton:=true
Bundle-Version: 1.0.0
Bundle-Activator: xxx.Plugin
Bundle-Vendor: xxx
Bundle-Localization: plugin
Bundle-NativeCode: native/dll/x1.dll;
native/dll/x2.dll;
native/dll/x3.dll;
native/dll/x4.dll;
native/dll/x5.dll;
native/dll/x76.dll;
native/dll/x.dll;
native/dll/x7.dll;osname = win32; processor = x86
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.ui,
org.apache.commons.logging
Bundle-ClassPath: .
Eclipse-AutoStart: true
Eclipse-LazyStart: true
Bundle-ActivationPolicy: lazy
Eclipse-BuddyPolicy: registered
Export-Package: xxx
清单B:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %plugin.name
Bundle-SymbolicName: xxx;singleton:=true
Bundle-Version: 2.1.16
Bundle-Vendor: xxx
Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.ui,
org.apache.commons.lang,
org.apache.commons.logging,
A
Export-Package: xxx
Bundle-ClassPath: .
Bundle-Activator: xxx
Eclipse-RegisterBuddy: A
Eclipse-AutoStart: true
Eclipse-LazyStart: true
Bundle-ActivationPolicy: lazy
答案 0 :(得分:1)
我的直接建议是将插件B转换为插件A的片段,而不是单独的插件,这将消除问题。
那就是说,我觉得你已经切换了你的清单;试图执行JNI调用的插件B应该有Eclipse-BuddyPolicy:registered
,插件A应该依赖并注册插件B.
那就是说,在阅读the buddyloading docs之后,我不确定buddyloading策略是否适用于非Java类文件。