jlink - Adding module at execution time

Gunnar Morling gunnar at hibernate.org
Mon Mar 13 08:21:16 UTC 2017


Got it. I guess what confused me was that --module-path and --module
are listed under "where options include" of java -help. So I assumed
they could be given in any order, not really noticing that last usage
example.

2017-03-13 9:01 GMT+01:00 Alan Bateman <Alan.Bateman at oracle.com>:
> On 13/03/2017 07:52, Gunnar Morling wrote:
>
>> Thanks for your help.
>>
>> It was failing because I had the "--module" parameter specified before
>> the "--module-path" parameter:
>>
>>      img/bin/java --module a/a.A --module-path modules
>>
>> This results in "FindException: Module a not found". It works if I
>> specify the "--module-path" option first:
>>
>>      img/bin/java --module-path modules --module a/a.A
>>
>> Similarly for "--upgrade-module-path", it's ignored when specified
>> after "--module".
>>
>> I wasn't expecting that options must be given in a specific order; is
>> this intentional?
>>
> Yes, because any arguments after that are arguments to the application main:
>
> $ java -help
> Usage: java [options] class [args...]
>            (to execute a class)
>    or  java [options] -jar jarfile [args...]
>            (to execute a jar file)
>    or  java [options] -p <modulepath> -m <modulename>[/<mainclass>]
> [args...]
>            (to execute the main class in a module)
>
> -Alan


More information about the jigsaw-dev mailing list