Recently discovered how to create dynamic classes in Java.

Thread.currentThread().getContextClassLoader().loadClass("DynamicClassPath")

And then if you want to invoke a method on it 🙂

Object obj = clazz.newInstance();
Method m = clazz.getMethod("methodName", null);

And then to call it:

m.invoke(obj, null);

about author-img author

I have no idea what to write here :(

no comments

Leave me comment