向Eclipse插件添加构建路径

时间:2023-02-05 18:05:31

I need to add a variable to a jar in my Eclipse plugin project. I get a "No class definition found" exception. My thought is that I need to add it somehow in the manifest file?

我需要在Eclipse插件项目中向jar中添加一个变量。我找到了“没有找到类定义”的例外。我的想法是我需要在清单文件中以某种方式添加它?

1 个解决方案

#1


The best way to do this (if it will work for you) is to include the jar in the bundle (plugin) from which you want to use it. This allows you to use the functionality in the jar, but not expose it to the rest of your application except through whatever API you provide for your plugin. You can add the jar to your plugin's classpath, which allows you to access all of its classes

执行此操作的最佳方法(如果它适用于您)是将jar包含在要从中使用它的bundle(插件)中。这允许您使用jar中的功能,但不会通过您为插件提供的任何API将其暴露给应用程序的其余部分。您可以将jar添加到插件的类路径中,这样您就可以访问它的所有类

It's best if you completely hide the external jar by not exposing its internal packages from the manifest file, and by not exposing any of its classes to the rest of the application, though if you need to do so, it is possible. I have done this both ways and prefer to hide the external jars. The Eclipse RCP book (McAffer and Lemieux) covers this process in some detail.

最好是通过不从manifest文件中公开其内部包来完全隐藏外部jar,并且不将其任何类暴露给应用程序的其余部分,尽管如果你需要这样做,它是可能的。我已经做到了这两种方式,并且更喜欢隐藏外部罐子。 Eclipse RCP书(McAffer和Lemieux)详细介绍了这个过程。

#1


The best way to do this (if it will work for you) is to include the jar in the bundle (plugin) from which you want to use it. This allows you to use the functionality in the jar, but not expose it to the rest of your application except through whatever API you provide for your plugin. You can add the jar to your plugin's classpath, which allows you to access all of its classes

执行此操作的最佳方法(如果它适用于您)是将jar包含在要从中使用它的bundle(插件)中。这允许您使用jar中的功能,但不会通过您为插件提供的任何API将其暴露给应用程序的其余部分。您可以将jar添加到插件的类路径中,这样您就可以访问它的所有类

It's best if you completely hide the external jar by not exposing its internal packages from the manifest file, and by not exposing any of its classes to the rest of the application, though if you need to do so, it is possible. I have done this both ways and prefer to hide the external jars. The Eclipse RCP book (McAffer and Lemieux) covers this process in some detail.

最好是通过不从manifest文件中公开其内部包来完全隐藏外部jar,并且不将其任何类暴露给应用程序的其余部分,尽管如果你需要这样做,它是可能的。我已经做到了这两种方式,并且更喜欢隐藏外部罐子。 Eclipse RCP书(McAffer和Lemieux)详细介绍了这个过程。