File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Reflecting classes not in classpath

 
Nickolay Kolev
Greenhorn
Posts: 16
  • 0
  • 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
  • 0
  • 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
  • 0
  • 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
  • 0
  • 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:
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic