On Mon, 2023-11-27 at 16:09 +0000, Mark Raynsford wrote: > > As I mentioned in the blog, I feel like almost all of the > functionality might already be there (minus a way to get the runtime > to use -p instead of -cp internally), it's just that there doesn't > appear to be a way to get jpackage to skip one of the steps that > causes the failure. >
Well, I feel silly. It turns out that it _is_ possible. The key part is the --runtime-image option. If there's a normal JDK/JRE image in "jre", and the application's modules are in "jars", then: jpackage \ --runtime-image jre \ -t app-image \ --module com.io7m.demo.m3 \ --module-path jars \ --name jpackagetest This will result in an application image where jpackage/lib/app/mods is a directory containing the untouched application jars. Additionally: $ cat jpackagetest/lib/app/jpackagetest.cfg [Application] app.mainmodule=com.io7m.demo.m3/com.io7m.demo.m3.M3 [JavaOptions] java-options=-Djpackage.app-version=20231111 java-options=--module-path java-options=$APPDIR/mods Running the application shows that it's definitely running in module path mode. I've no idea why I spent all day failing to combine the arguments in this particular way. Maybe my work in 2024 is to submit a documentation PR that adds this as an example to the jpackage manual page. -- Mark Raynsford | https://www.io7m.com