This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Class.forname" Watch "Class.forname" New topic


Mini Ramachandran

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)?
getClass().getName() gets the name of the class loaded.
Peter den Haan
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
subject: Class.forname
Similar Threads
Nullpointer exception in servlet
Creating a Class Object from the Input from a JTextField.
What Class.forName() does?
[newbie] IllegalAccessException