Java tutorial
//package com.java2s; import java.lang.reflect.Method; public class Main { private static Method loadMethod(String className, String methodName) { try { Method method = Class.forName(className).getMethod(methodName); method.setAccessible(true); return method; } catch (NoSuchMethodException ex) { return null; // the method was not found } catch (SecurityException ex) { return null; // setAccessible not allowed by security policy } catch (ClassNotFoundException ex) { return null; // the direct buffer implementation was not found } } }