Community
Participate
Working Groups
User should be able to export the modules and it's dependencies into a tun time image. Java 9 provides jlink (https://docs.oracle.com/javase/9/tools/jlink.htm#JSWOR-GUID-CECAC52B-CFEE-46CB-8166-F17A8E9280E9) tool to assemble modules into a run time image.
There are 2 things in Java 9 related to packaging of java 9 modules - 1. Packaging: Modular JAR files - As per JEP 261: Module System(http://openjdk.java.net/jeps/261) : The jar tool implements the following new options to allow the insertion of additional information into module descriptors as modules are packaged: --main-class=<class-name>, or -e <class-name> for short, causes <class-name> to be recorded in the module-info.class file as the class containing the module's public static void main entry point. (This is not a new option; it already records the main class in the JAR file's manifest.) --module-version=<version> causes <version> to be recorded in the module-info.class file as the module's version string. --hash-modules=<pattern> causes hashes of the content of the specific modules that depend upon this module, in a particular set of observable modules, to be recorded in the module-info.class file for later use in the validation of dependencies. Hashes are only recorded for modules whose names match the regular expression <pattern>. If this option is used then the ---module-path option must also be used to specify the set of observable modules for the purpose of computing the modules that depend upon this module. 2. The Java Linker - tool to assemble and optimize a set of modules and their dependencies into a custom runtime image. https://docs.oracle.com/javase/9/tools/jlink.htm#JSWOR-GUID-CECAC52B-CFEE-46CB-8166-F17A8E9280E9 http://openjdk.java.net/jeps/282 Jav 9 defines link time as an optional phase between the phases of compile time (the javac command) and run-time (the java run-time launcher). Link time requires a linking tool that will assemble and optimize a set of modules and their transitive dependencies to create a run-time image or executable. The inclusion of module details in jar file may be incorporated into Export->Java->Runnable Jar File Jlink can be part of new entry in Export or Configure.
(In reply to Sarika Sinha from comment #1) > There are 2 things in Java 9 related to packaging of java 9 modules - > 1. Packaging: Modular JAR files - As per JEP 261: Module > System(http://openjdk.java.net/jeps/261) : > The jar tool implements the following new options to allow the insertion of > additional information into module descriptors as modules are packaged: > > --main-class=<class-name>, or -e <class-name> for short, causes > <class-name> to be recorded in the module-info.class file as the class > containing the module's public static void main entry point. (This is not a > new option; it already records the main class in the JAR file's manifest.) > > --module-version=<version> causes <version> to be recorded in the > module-info.class file as the module's version string. Linking to the JDT/Core bug 516377 where we plan to add support for these additional attributes in module-info.class.
*** Bug 498983 has been marked as a duplicate of this bug. ***
When reading https://stackoverflow.com/questions/47878694/jpms-jigsaw-missing-main-class-in-module I wonder whether creating a Java 9 runnable jar requires the main class to be present *both* as an attribute in module-info.class *and* a manifest header? Or is one used for jar and the other for jmod? As for this bug this _could_ mean that IClasspathAttribute.MODULE_MAIN_CLASS should be interpreted during export and produce a manifest header from it (unless overridden in the wizard).
*** Bug 539788 has been marked as a duplicate of this bug. ***
Some more discussion - http://mail.openjdk.java.net/pipermail/jigsaw-dev/2017-February/011464.html Jar Documentation - https://docs.oracle.com/javase/9/docs/specs/jar/jar.html#Intro
Moving to 4.12.