dimanche 12 novembre 2017

accessing classes from a directory without knowing directory content

If I'm provided an address to a directory, but I have no information regarding what is within the directory, can I check to see if the directory contains any classes and access the classes via URLClassLoader.

I'm currently creating a URL array with the address of the directory:

URL [] urls = new URL[1];
urls[0] = new File(address).toURI().toURL();
URLClassLoader urlClassLoader = new URLClassLoader(urls);

However, even with this approach, I can't access classes from the URLClassLoader object since I don't know what the classes are called, right?





Aucun commentaire:

Enregistrer un commentaire