Class<?> defineClass (String name, byte[] bytes) throws ClassFormatError { try { Method method = ClassLoader.class.getDeclaredMethod("defineClass", new Class[] {String.class, byte[].class, int.class,int.class}); method.setAccessible(true); return (Class<?>)method.invoke(getParent(), new Object[] {name, bytes, new Integer(0), new Integer(bytes.length)}); } catch (Exception ignored) { //do nothing } return defineClass(name, bytes, 0, bytes.length); } }
accessorClass = loader.defineClass(accessorClassName, data);