jeudi 31 octobre 2019

how to use reflection the class which is not available in the package

How to create Class.forName("some package") which is not avalible in current package but it is running in the same JVM?

String jsConfigUpdatePkg = "com.baidu.openrasp.config.JSConfigUpdate";
Class<?> jcConfigClass = Class.forName(jsConfigUpdatePkg); // convert string classname to class
Class[] argTypes = new Class[] { String[].class };
Method updateConfigMethod = jcConfigClass.getDeclaredMethod("updateConfig", argTypes);

I'm getting ClassNotFoundException while doing Class.forName("some package")





Aucun commentaire:

Enregistrer un commentaire