Here you can find the source of invokeStatic(String cname, String methodName, ClassLoader cl)
public static Object invokeStatic(String cname, String methodName, ClassLoader cl)
//package com.java2s; //License from project: Open Source License import java.lang.reflect.Method; public class Main { private static final Class<?>[] EmptyClassArray = new Class<?>[0]; private static final Object[] EmptyObjectArray = new Object[0]; public static Object invokeStatic(String cname, String methodName, ClassLoader cl) { return invokeStatic(cname, methodName, cl, EmptyClassArray, EmptyObjectArray); }//from ww w .ja v a 2 s .c om public static Object invokeStatic(String className, String methodName, ClassLoader cl, Class<?>[] paramTypes, Object... params) { try { Class<?> c = getClass(className, cl); Method m = c.getDeclaredMethod(methodName, paramTypes); return m.invoke(null, params); } catch (Exception e) { throw new RuntimeException(e); } } public static <V> Class<V> getClass(String className, ClassLoader cl) throws ClassNotFoundException { return (Class<V>) Class.forName(className, true, cl); } public static <V> Class<V> getClass(String className) throws ClassNotFoundException { return (Class<V>) Class.forName(className); } }