Hi Rémi, Alan I use already jlink to keep only useful (for me) parts of JRE/JDK, and avoid most big thinks (like Java UI, CORBA, RMI, etc). Modular JAR are officially for migration [1] and are not used by modules from OpenJDK, even when they are pure Java. If they are a definitive target, why isn't it in OpenJDK a tool to transform a JMOD in a modular jar (at least when it is pure Java bytecode)? As I understand jlink as an optimizer tool [2], I would try to use it for all modules and expect it to be able to do so. If I can not do it good, because they resulting image format is too much restricted, I will mitigate to have a less bad solution.
My problem is that nothing in Jigsaw requires technically to store all modules of an image in a big single file, but new image format has made this choice. Having multiple files, each containing a set of modules would allow much more efficient trade-offs. This is particularly true for containers, and probably also in pure application suite (by making links to a jlink-optimized file containing a shared subset of modules). This is easy to be seen in containers, where the file system is usually the merge of multiples layers, like described in this image (from Docker [3]): https://docs.docker.com/engine/userguide/storagedriver/images/overlay_constructs.jpg Then having multiple files each with a specified set of modules allow some files to be shared between multiples containers. When we have all modules only in a single file, this file will never be the same between all containers and can never be shared. Then sharing common parts requires to convert non-shared modules in non-optimized modular JAR (blurring target of Jigsaw). I understand that it is too late for Java 9 to allow multiple files for modules in jlink-build images, each file storing a subset of the modules of the image (but I think it would be better if the current single file is already named "modules/0" and not "modules"). I would hope that it is not a definitive limitation of Java. Daniel. [1]: http://openjdk.java.net/projects/jigsaw/doc/topics/modularjar.html [2]: http://openjdk.java.net/jeps/282 [3]: https://docs.docker.com/engine/userguide/storagedriver/overlayfs-driver/ Le 31 août 2017 21:14:24 GMT+02:00, Remi Forax <fo...@univ-mlv.fr> a écrit : >Hi Daniel, >several points first, >the JRE doesn't exist anymore apart for compatibility (the jre is just >a bunch of modules) and a jar can be a modular jar, just have a >module-info.class in the jar, so applications that uses jars can be >modular, they do not have to use jlink. > >So you can have a jlink image as small as just java.base and all your >applications and their dependencies as modular jars, the modules will >be shared by the different applications, or a jlink all applications >and have no sharing at all and all the states in between. > >Rémi > >---------- >Modules can be packaged as JAR files too. You can even use most >existing >JAR files are modules. It does forfeit some of the benefits of creating >your own run-time image but maybe that is the trade off that you are >looking for. > >-Alan.