This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Java in General and the fly likes Dynamic class loading Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "Dynamic class loading " Watch "Dynamic class loading " New topic
Author

Dynamic class loading

Richard Green
Ranch Hand

Joined: Aug 25, 2005
Posts: 536
Ok. here is my problem




Please note the commented code snippet. I would like to dynamically load a class and pass it as an argument to the displayDocument() method.

However


is not valid, as they are incompatible conditional operand types. How do I get around this?

P.S: Interestingly, c.getInterfaces() returns an empty array (I expected it to return DocumentProviderIntf).

[ June 28, 2006: Message edited by: Lynette Dawson ]
[ June 28, 2006: Message edited by: Lynette Dawson ]

MCSD, SCJP, SCWCD, SCBCD, SCJD (in progress - URLybird 1.2.1)
Lionel Port
Greenhorn

Joined: Sep 14, 2002
Posts: 19
You only have the Class. You need to create an instance of the class.

 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Dynamic class loading
 
It's not a secret anymore!