Bug 518445 - [9] Java 9 Modules should be exported as run time image
Summary: [9] Java 9 Modules should be exported as run time image
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.7   Edit
Hardware: All All
: P3 enhancement with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Sarika Sinha CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 498983 539788 (view as bug list)
Depends on: 516377
Blocks:
  Show dependency tree
 
Reported: 2017-06-19 06:09 EDT by Sarika Sinha CLA
Modified: 2019-08-27 11:25 EDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sarika Sinha CLA 2017-06-19 06:09:32 EDT
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.
Comment 1 Sarika Sinha CLA 2017-07-05 00:22:22 EDT
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.
Comment 2 Stephan Herrmann CLA 2017-07-08 11:00:59 EDT
(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.
Comment 3 Noopur Gupta CLA 2017-07-25 07:03:08 EDT
*** Bug 498983 has been marked as a duplicate of this bug. ***
Comment 4 Stephan Herrmann CLA 2017-12-19 09:09:13 EST
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).
Comment 5 Noopur Gupta CLA 2018-10-04 07:46:22 EDT
*** Bug 539788 has been marked as a duplicate of this bug. ***
Comment 7 Noopur Gupta CLA 2019-02-07 03:08:10 EST
Moving to 4.12.