adam bien's blog

Playing with jpackage (JEP 392) 📎

jpackage was introduced to Java 16 as JEP 392
The jpackage command-line utility is based on the "legacy" javapackager and is useful to create self-contained application bundles.

To create an application bundle for the following Java application:


package airhacks;

public class App {

    public static void main(String[] args) {
        System.out.println("hello, jpackage");
    }
}    

perform:

jpackage --verbose --name javaaapp --input target --main-jar javaapp.jar --main-class airhacks.App

You can also skip the process of creating the installable bundle and only generate application image with the --type switch:

jpackage --verbose --name javaaapp --input target --main-jar javaapp.jar --main-class airhacks.App --type app-image

See it in action: