Here you can find the source of classForName(String className, Class caller)
public static Class classForName(String className, Class caller)
//package com.java2s; //License from project: Apache License public class Main { public static Class classForName(String className, Class caller) { ClassLoader tccl = Thread.currentThread().getContextClassLoader(); Class rtn = null;/*from w w w . jav a 2s. c o m*/ try { rtn = Class.forName(className, true, tccl); } catch (ClassNotFoundException e) { } if (rtn == null) { ClassLoader callerClassLoader = caller.getClassLoader(); try { rtn = Class.forName(className, true, callerClassLoader); } catch (ClassNotFoundException e) { } } if (rtn == null) { ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader(); try { rtn = Class.forName(className, true, systemClassLoader); } catch (ClassNotFoundException e) { } } return rtn; } }