How does jpackage search for modules?

Andy Herrick andy.herrick at oracle.com
Mon Feb 25 21:20:49 UTC 2019


Tobias:

After the latest fix (JDK-8217798: modular jar linking in jpackage) the 
following now works:

jpackage create-image --module 
de.asysgmbh.app.test/de.asysgmbh.app.test.Main --module-path 
/data/projects/javam/de.asysgmbh.app.test/target/modules ...

will work fine, but

jpackage create-image --module de.asysgmbh.app.test --main-class 
de.asysgmbh.app.test.Main --module-path 
/data/projects/javam/de.asysgmbh.app.test/target/modules ...

will not work. (actually it will build but them not run, saying: "module 
XXX does not have a ModuleMainClass attribute, use -m <module>/<main-class>)

In any case the latest EA does not work with modular jars, and a future 
version will prohibit mixing --module with --main-class options.

The help text will be re-written to clarify which options are used in 
which use cases.

/Andy



On 2/25/2019 3:00 PM, Tobias Oelgarte wrote:
> I'm wondering how jpackage searches for modules. I tried to build a 
> very simple example (using Build 17 of jpackage), but jpackage always 
> claims that the module can't be found.
>
> ~$ ./jpackage create-image \
>     --output /data/projects/javam/de.asysgmbh.app.test/target/image \
>     --name test \
>     --main-class de.asysgmbh.app.test.Main \
>     --module de.asysgmbh.app.test \
>     --module-path 
> /data/projects/javam/de.asysgmbh.app.test/target/modules
> ~ $ Module de.asysgmbh.app.test does not exist.
>
> The modules directory contains the file 
> "de.asysgmbh.app.test-1.0-SNAPSHOT.jar" including the 
> module-info.class with the module named "de.asysgmbh.app.test".
>
>     module de.asysgmbh.app.test { ... }
>
> The following works just fine:
>
> ~$ java \
>     --module-path 
> /data/projects/javam/de.asysgmbh.app.test/target/modules \
>     --module de.asysgmbh.app.test/de.asysgmbh.app.test.Main
>



More information about the core-libs-dev mailing list