如何将 jar 文件添加到 eclipse 插件?

How Add jar file to eclipse plugin?

我想在 eclipse 中编写一个插件,当 active window 更改时将 active window title 发送到端口。为此,我必须将 jna 和 jna-platform-win32 库添加到我的插件中。这个库在编译时添加,但是当我想在 运行 中使用它们时,库不起作用。我如何在 eclipse 中解决这个问题?

您必须将 jars 添加到插件 MANIFEST.MF 中的 Bundle-Classpath 并将它们包含在 'build.properties' 文件中,以便它们包含在插件构建中。

要添加到 Bundle-Classpath,请打开 plugin.xml 编辑器并转到 'Runtime' 选项卡。将罐子添加到 'Classpath' 部分(您还应该有一个 '.' 用于普通插件 类 的条目)。

plugin.xml 编辑器的 'Build' 选项卡更新了 build.properties 文件,因此请确保在二进制构建部分检查了 jars。