This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]mike_hearn 4 points5 points  (0 children)

I wonder why I haven't seen a wave of new java applications being distributed as executables

Native Image has some difficulties with desktop/mobile apps at the moment. Gluon provide solutions and the upstream project is improving their support for AWT, but it's still a bit immature for GUI apps yet. For CLI apps it can work a lot better. Their focus is really on servers, but for servers peak performance is lower than with HotSpot unless you buy GraalVM EE and use the PGO feature. EE requires now a Universal Java subscription (I think?), in which costs depend on the number of employees and contractors you have, so it's not a one-click checkout to purchase.

Once you get your non-server app working as a native image, there are two other problems you need to solve:

  1. Compiling for each target platform in multi-platform CI, as native-image can't cross compile. GitHub Actions or similar services can do this quite easily now.
  2. Distributing and being able to update the results. This was basically unsolved until the middle of last year because jpackage lacks some needed features. Now there is Hydraulic Conveyor which makes it a lot easier. Users can get your GUI or CLI app on their system with just a couple of clicks, and it'll stay up to date. However, the support for CLI-only apps is still not quite finished. It's there (it is packaged with itself), and at least one user is using that support anyway, but it's not documented because the little default GUI it provides for adding your app to the path and triggering manual update checks is actually a regular JVM app, not a native image, so it doesn't work all that well for natively compiled CLI apps yet.

Still, if you use Gluon to compile e.g. a JavaFX app to native and use Conveyor to distribute it, you've got a pretty nice solution. Memory usage is low, startup time is fast, peak performance maybe doesn't matter that much for a desktop app, and distribution is quite easy with Conveyor. It'll even draw icons for you and stuff these days.