----- Mail original ----- > De: "Malachi de Ælfweald" <malac...@gmail.com> > À: jigsaw-dev@openjdk.java.net > Envoyé: Mardi 5 Juillet 2016 09:00:22 > Objet: JDK9 Modules > > While I understand the motivation behind making the system more modular, I > am having a bit of a problem understanding how to use it with existing 3rd > party APIs. I saw the email thread with Alan and Stephen discussing how > there was a need to test some of the tools. > > Over the last couple weeks, I have been testing various APIs, mostly within > Gradle. While most of them work (as would be expected by any dev/user) a > couple did not work with JDK9. After spending a few hours trying the > various suggestions (jdeps, -addmods, etc) I have not yet managed to get > any API to work that showed a module problem. So far, my only resolution > has been to downgrade to JDK8, but that is obviously not the ideal solution. > > I'd really like to understand how to troubleshoot it and fix it so that I > can help others with the transition. So far, none of the suggestions I > have found work. > > Neo4j fails due to internal Sun classes being used: > cannot access class sun.nio.ch.FileChannelImpl (in module java.base) > because module java.base does not export sun.nio.ch to unnamed module > @0x6166e06f > > Dagger fails due to the @Generated: > NoClassDefFoundError: javax/annotation/Generated > > For the Neo4j case, I assumed I may just be out of luck with the sun.* > classes, however as an end-user I thought there would be some way to > specify that I want all modules installed. I could not figure out how to > do that. I tried to use jdeps to figure out what to do, but it is not very > friendly with dynamically included transitive dependencies. > > For the Dagger case, I know it is accepting the '-addmods' argument, > because it gives an error if I use '-J-addmods'. I also know that it is > accepting "java.annotations.common" because if I change it to javax, it > gives an error. But it still can't find the class. I've also tried > ALL-SYSTEM and ALL-UNNAMED. > > > I know that eventually these modules will have to be updated to include > their module export definitions... but what can I do to fix it. Better > yet, as an end-user, what can I do to just auto-resolve everything? > > > Malachi de Ælfweald > http://www.google.com/profiles/malachid >
Hi Malachi, javax.annotation package is in a module which is not a boot module anymore, (because this package is defined both by the java se spec and the java ee spec and jigsaw doesn't allow split package) you should use "-addmods java.se.ee", see JEP 261 [1] (you can look for java.se.ee in the text) cheers, Rémi [1] http://openjdk.java.net/jeps/261