Here you can find the source of loadClass(String className)
public static Class<?> loadClass(String className) throws ClassNotFoundException
//package com.java2s; /******************************************************************************* * Copyright (c) 2007 - 2013 Spring IDE Developers * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors:/*from ww w .j a v a 2 s .c o m*/ * Spring IDE Developers - initial API and implementation *******************************************************************************/ public class Main { public static Class<?> loadClass(String className) throws ClassNotFoundException { ClassLoader loader = Thread.currentThread().getContextClassLoader(); return loadClass(className, loader); } public static Class<?> loadClass(Class clazz) throws ClassNotFoundException { return loadClass(clazz.getName()); } public static Class<?> loadClass(String className, ClassLoader loader) throws ClassNotFoundException { try { return loader.loadClass(className); } catch (ClassNotFoundException ex) { int lastDotIndex = className.lastIndexOf('.'); if (lastDotIndex != -1) { String innerClassName = className.substring(0, lastDotIndex) + '$' + className.substring(lastDotIndex + 1); try { return loader.loadClass(innerClassName); } catch (ClassNotFoundException ex2) { // swallow - let original exception get through } } throw ex; } } }