Is it possible to use dependencies without module-info.class in a Java 9 module

喜你入骨 提交于 2019-12-04 01:15:36

Yes, it is possible. What you are looking for are automatic modules.

To create one you simply put a regular JAR into a folder that you mention on the module path (e.g. guava-19.0.jar in a folder libs - see my example project). This tells the JVM to create a module from it. This module will get a name based on the file name (in this case guava), will read all other modules, and export all of its packages.

You can then require it with the name it was given (e.g. require guava; - see here).

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!