[forge-users] ClassLoading - how to make every class (in the visited project) accessible ?

forge-users at lists.jboss.org forge-users at lists.jboss.org
Wed Feb 25 11:13:50 EST 2015


The context is using one's own addon in a second project. Say this addon manipulates all the @Path classes

As I was playing with code generation, I faced issues while trying to do Class.forName() because the addon has no knowledge of P2 classpath.

What I did is infer the file path of the sources and then use Roaster to get a JavaInterface.
But now, if I wanted to introspect (the java.lang.reflect way) a class declared in a dependency of this second project (like a class defined in twitter4j for example), how would I do ?

Should I loop on all JARs in the visited project then loop on all the JAR's .class entries and tell the classloader to load them ?
And same for target/classes ?

Or is it a special classloader that I haven't found ?



Posted by forums
Original post: https://developer.jboss.org/message/920001#920001

More information about the forge-users mailing list