Java dynamically load plugin
问题 I want to make an application that can dynamically load plug-ins but I've not found any literature on Internet. The difficult thing is: I don't know the name in advance. For example I've a Plugin interface: public interface Plugin { public static Plugin newPlugin(); public void executePlugin(String args[]); } So that every Class implementing Plugin in the jar file are instantiated in a list: Method method = classToLoad.getMethod ("newPlugin"); mylist.add(method.invoke(null); First problem is,