• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Reflecting classes not in classpath

 
Nickolay Kolev
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
Is there a way to load a class fo reflection wich is not in the classpath, but rather in the same directory as the reflecting class?
I am trying to load a class and examine its swing components...
Any tips on how this could be achieved?
Many thanks,
Nickolay Kolev
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you will need to use a custom ClassLoader for this. Don't know much more about it, though...
 
Dave Landers
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use something like this:

And load classes like this:

Enjoy!
[ October 30, 2002: Message edited by: Dave Landers ]
 
Junaid Bhatra
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Instead of writing your own Classloader, I guess you could use the built-in URLClassLoader for the same purpose:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic