When building a minimum JavaFX app for Windows platform using Gluon’s client-maven-plugin incorporating GraalVM native image, the final exe size is approx. 60 MB. Is there something in the plugin config what can be tweaked on my side to reduce this size?
Using UPX I can reduce the final size to 16 MB (however with drawbacks), by 7z compresssion just to 13 MB, but I’d like to reduce the input itself.
No, you can’t. The needed JDK "features" need their disk space.
GraalVM does this:
- Takes your Java classes.
- Compiles them ahead of time into native machine Code.
- Includes only the classes you need.
- Creates a very small self contained package.
So you see, there are all parts removed already which are not needed. 60mb is NOT much by the way. A full featured JDK has around 380mb.
What to do next:
You can save space if you use smaller ressource files like images etc.
Check out this video of GraalVM for more information:
Answered By – David Weber