jlink - Adding module at execution time

Alan Bateman Alan.Bateman at oracle.com
Sun Mar 12 21:52:13 UTC 2017

On 12/03/2017 21:20, Gunnar Morling wrote:

> Hi,
> I've created a custom runtime image using jlink and would like to add
> an additional module at execution time which should be the module with
> the main class.
> But that additional module is not found when running
>      <IMAGE>/bin/java
>          --module-path path/to/additional-module
>          --module com.example.additionalmodule
> Then I stumbled upon the --upgrade-module-path option. So I thought I
> could add my module to the image at link time and then override it
> with a newer version at runtime. But it keeps using the original one.
I'm surprised by that because the search order is:

    [--upgrade-module-path] <system> [--module-path]

which <system> is the run-time image. So while --upgrade-module-path is 
intended for deploying new versions of "upgradeable modules" then I 
would expect that it would work here.


> It seems this is only meant for upgradeable system modules? Or can I
> mark my application module as "upgradeable" somehow?
> My use case is to have a runtime image with the dependencies of an
> application (which are fairly stable) and then add the application
> module(s) (which are frequently changing) themselves at execution
> time.
> Is there a way for achieving this?
> Thanks for any advice,
> --Gunnar

More information about the jigsaw-dev mailing list