I came up with a great way of making an app which could load plugins at run time. Unfortunately, it was only as great as my understanding of the problem at the time. Here is what I do -
The idea I had was to create an interface, IGPPlugin, that each plugin would implement. I would make a program that would run and go into a plugins directory and load any plugins it found there. I wanted to have a file structure like this - myprogram plugins/plugin1 plugins/anotherplugin If I jar my application up, it will find the plugin directory, but then won't instantiate each plugin. If I leave it un-jarred, things are ok. The other issue is with innerclasses. I had wanted to make this nice neat directory with each file/class being a plugin. The problem is that a gui is involved, which means some type of innerclass and more class files. That is why I had to do the simple check in the above code for the $, as innerclasses will compile with that in the filename. Ok, the meat of the question is this - Does anyone have any solutions/ideas on a convenient way for me to make a 'nice' distributable that other developers can just drop plugins they or others develop into a directory? Something like this maybe - myprogram.jar plugins/plugin1.jar plugins/anotherplugin.jar All ideas valued! Regards!
OK Im not sure if this will be of much help, but jedit is an open source editor that is stable, widely used and handles plugins. The source code is avialable at sourceforge. Might be a good place to start investigating..
Look into extending ClassLoader and overriding findClass() to look in your plugin directories. I've never done this, but have been thinking about trying it the last couple days. So let me know what you find!
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi