mardi 10 octobre 2017

Java 9 webstart JNLP Service produces IllegalAccess

The following code worked in Java 8 but failed in Java 9:

Class<?> mclass = Class.forName("javax.jnlp.ServiceManager");
Method lookup = mclass.getMethod("lookup", new Class[]{String.class});
Object basicSvc = lookup.invoke(null, new Object[{"javax.jnlp.BasicService"});
Class<?> sclass = basicSvc.getClass();
Method getCodeBase = bclass.getMethod("getCodeBase", (Class[])null);
URL codebase = (URL)getCodeBase.invoke(basicSvc, (Object[])null); // throws

Results in

java.lang.IllegalAccessException: class app.App cannot access class
  com.sun.jnlp.BasicServiceImpl (in module jdk.javaws) because module
  jdk.javaws does not export com.sun.jnlp to unnamed module @7202a0fa
    at http://ift.tt/2kCGayA
    at http://ift.tt/2wLxPdj
    at http://ift.tt/2wE83Yn
    at app.App.init





Aucun commentaire:

Enregistrer un commentaire