I\'m trying to dynamically load a java class. The basic idea is, that a jar contains modules which get loaded dynamically at runtime. This is how I do it (I know it\'s hacky
I had the same problem when trying to create a ant task for code generation based on a declarative approach using annotations. I found that the documentation of the Proxy - Object states that instanceof should resolve it, but this didn't work fopr me neither. I finally got a around with
Annotation[] annotations = classObj.getAnnotations();
for(int i = 0;i < annotations.length;i++) {
Class>[] interfaces = annotations[i].getClass().getInterfaces();
for(int i2 = 0; i2 < interfaces.length;i2++) {
System.out.println("interface:" + interfaces[i2].getName());
}
giving my the name of the original annotation, so comparing this name to the annotations classname will give you the desired result.