It's not a secret anymore!*
The moose likes Java in General and the fly likes dynamically loading a class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "dynamically loading a class" Watch "dynamically loading a class" New topic
Author

dynamically loading a class

ralph roper
Greenhorn

Joined: Nov 25, 2001
Posts: 25
Is there a way to pass constructor parameters when dynamically loading a class ? ie Class.forName()
The class I am trying to load is related to a database table. Does anyone know if using JDO is a better alternative to dynamically loading a class ? (.. or am I completely off the track here
?)
Steve Deadsea
Ranch Hand

Joined: Dec 03, 2001
Posts: 125
Use the Class.getConstructor(Class[] parameterTypes) method and then get a new instance from that Constructor using Constructor.newInstance(Object[] initargs)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: dynamically loading a class