View Single Post
  #4 (permalink)  
Old 01-03-2008, 01:18 AM
jelly's Avatar
jelly jelly is offline
Member
 
Join Date: Jan 2008
Location: Somerset, UK
Posts: 46
jelly is on a distinguished road
Assuming the name of the class that you want to create an instance of is in a properties object called props under the key "abc" and that the class named supports an interface called MyInterface. Code below will work as long as the class specified has an empty constructor.

String className = props.getProperty("abc");
Class c = Class.forName(className);
MyInterface myInstance = (MyInterface) c.newInstance();
Reply With Quote