• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Importing a Java Class to a program

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys,

I have a question here which I really have no idea on how to deal with it. Hopefully it does belong here and not to the Beginner forum...

The situation is like this, I have (or is going to have) a program A that is going to generate another program B. I wish to allow the user of my program A, to specify a Java .class file which is to be imported into the generated program B. The only requirement of the imported Java .class file is that it has a specified function that is required for program B. This check is supposed to be made by program A.

Is this possible? And if it is, could I have some brief guide on how to do it? THanks. Cheers...

(^-^)
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes. You've got the loadClass(String name) method available in java.lang.ClassLoader. Once you've loaded it you can interrogate it for your method - look at the methods available in java.lang.Class.
 
reply
    Bookmark Topic Watch Topic
  • New Topic