automatically downloading and enabling a jigsaw module

Jochen Theodorou blackdrag at gmx.org
Fri Jul 29 08:22:12 UTC 2016


Hi all,

as some may know Groovy has this @Grab feature, which works only 
partially in JDK9, because of the change of not using an URLClassLoader 
anymore for the startup class loaders.

Now I am of course wondering what the exact requirements are for a 
program to get a module jar from the Internet (let us assume we have a 
solution for that part), and then load it, so that a program can use 
classes from this module as well as any services the module may provide. 
And of course let us discuss this for Java-only code, I should then be 
able to make the transition to Groovy code quite easily.

So the scenario I would like to sketch out is the following... I want to 
deliver a precompiled jar that will download its dependencies by itself. 
Let us say we will use a sql driver as well as a custom xml parser and 
asciidoc. The driver spec will be given in at the command line. The 
purpose of the program is to load an xml report, transform it to 
asciidoc and then save that in a predefined sql table.

To start off I guess there would be a small gateway program, that 
handles the command line arguments and issues the download of the 
modules. What comes after that? Is it as easy as spawning a new class 
loader and load the modules in that loader as well as the reminder of 
the program? Is there an alternative way of doing this? How do I add the 
modules to the current layer? Or if a different layer... Will my program 
then still have access to the services?


bye Jochen


More information about the jigsaw-dev mailing list