graalvmgraalvm-native-imagejpackage

Can I use jpackage to build application images for native applications created with Graals native-image?


I have native Java application, build with native-image from Graal. As I have never worked with jpackage, I would like to know if I can use to to build installers with it for native applications too?


Solution

  • Jpackage can create msi or dmg or deb as described here. I tested with my javafx+graalvm project under windows and it is created the msi.

    ozkan@HP-ENVY-2021-I7 C:\Users\ozkan\projects\swaggerific\target\gluonfx
    $ jpackage -n nameofthepackage -t msi  --runtime-image installable
    
    ozkan@HP-ENVY-2021-I7 C:\Users\ozkan\projects\swaggerific\target\gluonfx
    $ dir installable
     Volume in drive C is Windows
     Volume Serial Number is BC27-F52E
    
     Directory of C:\Users\ozkan\projects\swaggerific\target\gluonfx\installable
    
    26/06/2024  22:46    <DIR>          .
    26/06/2024  22:49    <DIR>          ..
    15/06/2024  18:43        92,965,888 swaggerific.exe
                   1 File(s)     92,965,888 bytes
                   2 Dir(s)  139,368,534,016 bytes free
    
    ozkan@HP-ENVY-2021-I7 C:\Users\ozkan\projects\swaggerific\target\gluonfx
    $ dir
     Volume in drive C is Windows
     Volume Serial Number is BC27-F52E
    
     Directory of C:\Users\ozkan\projects\swaggerific\target\gluonfx
    
    26/06/2024  22:49    <DIR>          .
    13/06/2024  22:40    <DIR>          ..
    26/06/2024  22:46    <DIR>          installable
    15/06/2024  18:43    <DIR>          log
    26/06/2024  22:49        31,346,688 nameofthepackage-1.0.msi
    15/06/2024  18:44    <DIR>          x86_64-windows
                   1 File(s)     31,346,688 bytes
                   5 Dir(s)  139,368,534,016 bytes free
    

    When I installed the generated MSI which created this folder C:\Program Files\nameofthepackage and I can see my exe inside.

    But I would suggest you to consider Gluon instead, even without javafx it can generate the package you want. Check these ymls.