I'm trying to create a native installer using jpackage for a relatively small program. The created app image is ~120 MB in size. This is odd since I used jlink before and the runtime image only used to be ~40 MB. After some digging, I found runtime/lib/modules
in my app image, a file 90 MB in size. As runtime/legal
lists a lot of things (modules?) I don't use, I think that jpackage packs things it shouldn't, but I'm not sure.
Note: The program isn't supposed to be modular. My understanding is that this is only useful when making multi-part programs or libraries. I used the module-info.java
that was autocreated by eclipse to, well, "trick" jlink into creating a runtime image.
Here are the args I use to create the app image.
--type app-image
--name myapp
--dest target\appimg
--temp target\appimg-work
--input target\jar
--icon .\icon.ico
--main-jar target\jar\myapp.jar
--main-class com.msgprograms.myapp.AppMain
After copying some files into the app image, I create the installer using another jpackage run, this time using these args:
--type msi
--app-version 0.0.1
--copyright "(C) msgprograms"
--description "some app"
--name myapp
--dest target
--temp target\installer-work
--vendor msg-programs
--app-image target\appimg\myapp
// omitted windows-specific args
Why is the app image so big and how do I make it smaller? Is there a way other than making the program modular again, creating a runtime image with jlink and then giving that to jpackage?
EDIT:
I forgot to mention that the app doesn't use JavaFX. All articles I found on jpackage do though, so they're of limited help only.
EDIT 2:
Trying to be clever by doing --jlinkoptions "--add-modules java.desktop"
doesn't work, as jlink option [--add-modules] is not permitted in --jlink-options