Java Class Load loadClass(final String className)

Here you can find the source of loadClass(final String className)

Description

Loads the class with the given name, or null if it cannot be loaded.

License

Open Source License

Declaration

public static Class<?> loadClass(final String className) 

Method Source Code

//package com.java2s;

public class Main {
    /** Loads the class with the given name, or null if it cannot be loaded. */
    public static Class<?> loadClass(final String className) {
        return loadClass(className, null);
    }// www  . j a v a2 s .c o m

    /** Loads the class with the given name, or null if it cannot be loaded. */
    public static Class<?> loadClass(final String className, final ClassLoader classLoader) {
        try {
            if (classLoader == null)
                return Class.forName(className);
            return classLoader.loadClass(className);
        } catch (final ClassNotFoundException e) {
            return null;
        }
    }
}

Related

  1. loadClass(ClassLoader loader, String className, String errorMessage)
  2. loadClass(final ClassLoader cl, final String cname)
  3. loadClass(final ClassLoader classLoader, final String classname)
  4. loadClass(final String className)
  5. loadClass(final String className)
  6. loadClass(final String className)
  7. loadClass(final String className)
  8. loadClass(final String className, final ClassLoader classLoader)
  9. loadClass(final String className, final ClassLoader classLoader)