How to get a Class Object from the Class Name in Java
Class.forName("MyClass")
Read the JavaDoc for details
You can use:
Class c = Class.forName("com.package.MyClass");
And later instantiate an object:
Object obj = c.newInstance();
EDIT: This is just the simplest use case. As indicated in the comments, you will need to consider constructor arguments and exceptions thrown by the initialization process. The JavaDocs for newInstance
has all the details.