aspose file tools*
The moose likes JDBC and the fly likes Class.forname Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Class.forname" Watch "Class.forname" New topic
Author

Class.forname

Mini Ramachandran
Greenhorn

Joined: Jan 11, 2001
Posts: 17
How do I get the name of the "className" initialized here from another class (both in the same package)?
Class.forname("className").newInstance();
getClass().getName() gets the name of the class loaded.
Thanks.
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
Not sure what exactly you are asking... but are you looking for the class literal? TheClass.class.getName() will return "your.package.TheClass" and will instantiate TheClass if passed as argument to Class.forName().
- Peter
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Class.forname