Java tutorial
//package com.java2s; public class Main { public static Object getObjectByClasspath(String classpath) { Object object = null; try { Class clazz = Class.forName(classpath); object = clazz.newInstance(); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } return object; } }