wood burning stoves 2.0*
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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
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
 
Similar Threads
object.class
Creating a Class Object from the Input from a JTextField.
What Class.forName() does?
Nullpointer exception in servlet
[newbie] IllegalAccessException