I allow the user to import plugin-like classes from a remote location using URLClassLoader, so these imported classes DO NOT exist in the build path (however, they all implement the IPlugin interface, which is included).
I suggested that you can simply use ObjectOutputStream to save all loaded plugins to a file and then read them with ObjectInputStream. However, this is not so, since all that it saves is the state of the object, and not containing logic (i.e.Methods).
I would like to save the list of loaded plugins (activePlugins) using ObjectOutputStream:
ObjectOutputStream oos = new ObjectOutputStream(*fileoutputstream*);
oos.writeObject(activePlugins);
oos.close();
Then at another runtime load / restore all of these plugins using ObjectInputStream:
ObjectInputStream ois = new ObjectInputStream(*fileinputstream*);
activePlugins = (ArrayList<IPlugin>) ois.readObject();
( - ), haywire. , , - , .. .