0

To all Java 9 users who could help,

In versions prior to Java 9, we could dynamically load a jar, by simply appending it to the classpath at runtime. For doing this, we used the Someclass.class.getClassLoader(), casted to an URLClassLoader, thus permitting to access addUrl method by reflection (as addUrl method is a protected one). And this solution worked very well, until now, because of an upcoming update of our JREs.

In Java 9, ClassLoader cannot be cast to URLClassLoader anymore. Creating a new instance of URLClassLoader instead of a casted one for doing the same thing...just doesn't work (at least in my tests).

If anyone knows the actual solution, in Java 9, for appending multiplatform library jars to the classpath, the answer would be really (really) appreciated.

Thank you very much in advance !

GlobCoder
  • 21
  • 5

0 Answers0