lundi 17 décembre 2018

Load and access resources from a jar via reflection

in my project, I have to load a jar which contains some code, and to execute it. I just know that this code implements some interface and that its name in written in the manifest of the jar. So far so good, with URLClassLoader/loadClass/newInstance...

I had some troubles when this class calls other classes, but with some trick consisting of loading all files ending with .class in the jar entries works.

However, this code (that I don't know), may use some resources (files), which are in the jar. How can I allow this code to load such resources? It seems that it's not in the classpath and that it cannot find it at runtime.

Thanks





Aucun commentaire:

Enregistrer un commentaire