Building a modular JAR file
We've looked at creating complete modular runtime images and learned about the advantages of the linking process, but sometimes that may not be what you want. Suppose you are a library developer and you just want to bundle a single utility module as a jar file. When building a jar file from a module, you have an option of creating a modular JAR file. A modular jar file is just like any other jar file, but with the module-info.class file in the root directory. You can use this to distribute compiled modules as a single file instead of the whole module folder. You can drop a modular JAR file in a module path when running the java command, and it behaves just like the compiled module folders that we've been dealing ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access