samedi 5 juin 2021

URLClassLoader addURL() Java 16 Illegal reflective access

i currently developing a "addon" based system for my minecraft server. Now i have a problem. if i run it on Java 16, it throws a "Illegal Reflection Exception" and the operation will be denied. I try to call the addURL() method from URLClassLoader.

Here is my code:

try {
  addURL = URLClassLoader.class.getDeclaredMethod("addURL", URL.class);
  addURL.setAccessible(true);
} catch (final Throwable e) {
    e.printStackStrace();
}

Can someone help me to solve that? How i can make that possible in java 16?

Thanks for help





Aucun commentaire:

Enregistrer un commentaire