jlink - Adding module at execution time

Alan Bateman Alan.Bateman at oracle.com
Mon Mar 13 08:01:20 UTC 2017

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>] 
            (to execute the main class in a module)


More information about the jigsaw-dev mailing list