Implementing a plugin interface
What's a good way of adding a plugin interfac开发者_如何学运维e such that it's possible to have optional components?
I'm aware of the Class.forName() approach (used with JDBC for example) but there is also this approach to dynamic class loading.
You may have a look at this: http://jpf.sourceforge.net/.
A good approach would be to load jar files in a specified directory at runtime and look if they contain plugin classes. Have a look at this: How to load a jar file at runtime.
精彩评论