Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

class loader

 
yogi ta dev
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,
I have to load .class files .Can anyone pls let me know how to do it?
I have tried searching ,but could not find.
Thanks,
yogita
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24208
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Welcome to JavaRanch!

Depends what you want to do, exactly. If you're just loading them from normal .class files, The static method forName() in the java.lang.Class class will do it for you. If you're doing something fancier, you may need to write your own ClassLoader, or at least explicitly use one of the standard ones. Let us know what you need to do.
 
yogi ta dev
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an array which has all class files names.I have to check if they exist in classes directory and load them,then use refection to get methods
in each of the classes.

Thanks,
yogita
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yogi dev, Welcome to JavaRanch!

We ain't got many rules 'round these parts, but we do got one. Please change your display name to comply with The JavaRanch Naming Policy.

Thanks Pardner! Hope to see you 'round the Ranch!
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm moving this to the Intermediate forum...
[ November 27, 2004: Message edited by: Dirk Schreckmann ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic