2 Replies Latest reply on Feb 27, 2015 4:34 AM by Jerome B

    ClassLoading - how to make every class (in the visited project) accessible ?

    Jerome B Newbie

      Hello,

       

      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 ?

       

      Cheers,

       

      Jerome