I would like to instantiate a list of objects from a certain directory without previous knowledge of their existence. I do however know that the classes all inherit from the same parent.
Directory
Some.java
SomeOther.java
YetAnother.java
I have tried to use the URLClassLoader
as such:
URLClassLoader.newInstance(new URL[]{file.toURI().toURL()})
But cannot create the class because I do not know its name in advance.
How can I create an array of objects from a list of .java
files.
Aucun commentaire:
Enregistrer un commentaire