JDK-8217793 : Modular jars in jpackage are not working
  • Type: Bug
  • Component: tools
  • Sub-Component: jpackage
  • Affected Version: internal
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2019-01-25
  • Updated: 2019-03-22
  • Resolved: 2019-01-31
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
internalFixed
Related Reports
Relates :  
Description
review feedback:
------------------------
6. Generate an application image from a non-modular JAR file

I think this means to say "Create a non-modular application image"

When I run it, it does fail and does not accept modular JAR files.

$ jpackage create-image --input dist --main-jar hi.jar -n Hello --output myapp1 --force
Exception: java.lang.Exception: Error: Modules are not allowed in srcfiles: [dist/hi.jar, dist/lib/lib.jar].
Error: Bundler "Mac Application Image" (mac.app) failed to produce a bundle.

A modular JAR can run on the class path as a non-modular app.  This seems very restrictive. I would expect we should support it as libraries should migrate to a modular JAR in order to run on 8u and new releases as modules.
-----------------------------------

Comments
The code in JLinkBundlerHelper specifically asserts that if main-jar is modular jar, no jars can be modular jars. We will just remove that check and then modular jars work just like non-modular jars
29-01-2019

This issue is about two things: 1.) jpackage is broken when given a modular jar. 2.) The "Sample usage" description line for the first two commands in the help text is incorrect I added the second point above as item 11 in the description of JDK-8217687. This CR will be about fixing the the implementation of modular jars.
28-01-2019

I can reproduce with: jpackage create-image \ --input input \ --output output \ --name mjar \ --main-jar mjar.jar \ --class me.mymodule.Main \ --files mjar.jar \ throws exception at : at jdk.jpackage/jdk.jpackage.internal.JLinkBundlerHelper.execute(JLinkBundlerHelper.java:280) but java -cp input/mjar.jar me.mymodule.Main works fine
25-01-2019