我想将一些 DLL 从相关的本机 JNI 类中分离出来。
插件:
- 在插件 A 中,加载插件时会放置和加载 dll。
- 在插件 B(依赖于 A)中,放置了 JNI 类,其中包括对 A 中 DLL 的本机方法调用。
在运行时我得到一个 UnsatisfiedLinkError 因为找不到 JNI 类。我尝试通过更新清单文件来更新类加载器逻辑:
插件 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