开发者

Java Plugin Framework (JPF) and SystemClassLoader

Hello stackoverflow world,

I am stuck on a little problem with Java Plugin Framework and I can't find in the documentation an answer to it.

The question is surprisingly simple: how to make available from the system class loader the classes brought by a plugin?

In other words: I have a plugin that brings a class P开发者_如何学JAVAluginA, and I want to be able to instantiate PluginA from the main application (not from the plugin). This is by default not allowed because each plugin has its own class loader...

The best for me is to have a jar included in the plugin archive and load this jar in the system class loader, but how to do that???

If anyone has a idea, thanks!

Nicolas


Problem solved. A plugin is composed of a zip archive and a jar. The code dedicated to the installation of the plugin and its initialization in located in the zip archive (and the Plugin JPF class so). Whereas the code that constitutes the feature itself of the plugin is located in a separate jar, and I add the jar to the classpath at runtime using http://jimlife.wordpress.com/2007/12/19/java-adding-new-classpath-at-runtime/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜