I am doing a little application for executing classes dynamically. I'm already able to test it by loading one class at the time to the classpath at runtime, but now I have to do it by loading all those classes from a JAR.
I have my .class files on a .jar, which is successfully loaded to the classpath at runtime, so I know the classes are there somewhere. Now what I have to do is execute given methods (user enters method names on the UI) on those classes but I don't know where to find them and if it's possible to invoke reflection on them.
I've used ClassPathHacker, too, but not in production. Using reflection to violate the designer's intent in the core library is not something I'd try to sell my peers on.
I'm not sure why you needed it. You said the jar was "loaded to the classpath at runtime." If that means the jar is in the classpath at JVM startup, you can work with any class in the jar with no more foolin around. All you need is:
Class.forName( fully.qualified.ClassName )
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
subject: Reflection on files already on the classpath