Using the jpackager

Rachel Greenham rachel at
Fri Nov 9 23:59:27 UTC 2018

None, that's just my own class task in buildSrc. It's a fairly trivial 
wrapper around a ToolProvider invocation of jlink, so I didn't think it 
was relevant enough to paste the source for that here too, when you 
could also do it trivially with an Exec task similar to the jpackager 
ones later in my first reply.

It's literally public class JLink extends DefaultTask with a bunch of 
getters and setters for the options and a run method that turns them 
into arguments and invokes via ToolProvider. The same task type is also 
used elsewhere in the root project to build the server JRE for the 
server component of this project, which was enough to make it worthwhile 
writing the task. (I also wanted to learn how to write java gradle 
tasks.) The point of the example I did paste was just about showing what 
options to set to jlink. jlink in any detail is offtopic here, this bit 
was just an illustration of using that to build the JRE first with the 
required modules, then use the result in jpackager to build a 
non-modular app.

I would expect to write a similar simple task for jpackager too at some 
point, I just haven't yet. They may be the basis of a useful packager 
plugin, but probably not before jpackager itself is more mature.


On 09/11/2018 21:34, Sverre Moe wrote:
> Den fre. 9. nov. 2018 kl. 16:22 skrev Rachel Greenham <rachel at 
> <mailto:rachel at>>:
>     Build the JRE needed using JLink, supplying the needed modules. The
>     JLink task referenced is actually written in Java and wraps
>     ToolProvider, but it's pretty trivial and could almost-more-easily be
>     done with an Exec. NB: The JLink task as written puts it in a "java"
>     subdirectory of the given destinationDir.
>          task buildAdminJre(type: JLink) {
>              description 'Build the Client JRE for ' + nativeOsName
>              destinationDir
>     rootProject.file("deploy/bindist/"+requiredJava.merusNativeAdminJreName)
>              modules = [
>                  'java.base',
>                  'java.desktop',
>                  'java.xml',
>                  'java.logging'
>              ]
>              bindServices false
>              modulePath =
>     ['java.home')+File.separatorChar+'jmods']
>              noHeaderFiles true
>              noManPages true
>              stripDebug true
>          }
> Which gradle plugin are you using that gives you type JLink?

More information about the openjfx-dev mailing list