操纵Eclipse插件的Java类路径? [英] Manipulate the java class path of an Eclipse plugin?

查看:41
本文介绍了操纵Eclipse插件的Java类路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个包含Eclipse自制视图的插件.当我运行插件并使用 System.getProperty("java.class.path")显示类路径时我将其作为输出: D:\ Programs \ eclipse \ plugins \ org.eclipse.equinox.launcher_1.3.100.v20150511-1540.jar

I am working on a plugin that consist of a homemade view to Eclipse. When I run the plugin and display the classpath using System.getProperty("java.class.path") I get this as output : D:\Programs\eclipse\plugins\org.eclipse.equinox.launcher_1.3.100.v20150511-1540.jar

我想添加一些.jar文件以实现我的视图的正常运行,但是我不知道如何...我想您可以通过向插件的MANIFEST.MF添加一些规范来做到这一点,但是我不知道该怎么做.有任何想法吗 ?

I would like to add some .jar files for the proper functioning of my view, but I can't figure out how... I guess you can do it by adding some specifications to the MANIFEST.MF of the plugin but I don't know how to do it propely. any ideas ?

推荐答案

每个Eclipse插件都有自己的类路径.要在插件中使用其他jar,您需要将其包含在插件中.

Each Eclipse plugin has its own classpath. To use additional jars in the plugin you need to include them in the plugin.

将您的jar添加到插件目录.通常将它们放在"lib"目录中.

Add your jars to the plugin directory. Usually they are put in a 'lib' directory.

打开插件MANIFEST.MF编辑器,然后在类路径"部分的运行时"选项卡上,单击添加..."按钮,然后将jar添加到类路径.

Open the plugin MANIFEST.MF editor and on the 'Runtime' tab in the 'Classpath' section click the 'Add...' button and add your jars to the class path.

在编辑器的构建"选项卡上,确保二进制"部分中包含"lib"文件夹.

On the 'Build' tab of the editor make sure the 'lib' folder is include in the Binary Build section.

您的MANIFEST.MF应该以一个类似于以下内容的捆绑类路径"条目结尾:

Your MANIFEST.MF should end up with a `Bundle-Classpath' entry that looks something like:

Bundle-ClassPath: .,
 lib/jogg-0.0.7.jar,
 lib/jorbis-0.0.15.jar,
 lib/vorbisspi1.0.2.jar

(这里我在lib文件夹中有3个jar).

(here I have 3 jars in a lib folder).

build.properties文件应类似于:

The build.properties file should be something like:

bin.includes = META-INF/,\
               .,\
               plugin.xml,\
               lib/,\
               lib/jogg-0.0.7.jar,\
               lib/jorbis-0.0.15.jar,\
               lib/vorbisspi1.0.2.jar

这篇关于操纵Eclipse插件的Java类路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆