Search code examples
javajpackage

JPackage-result installed - how to add system properties?


I already have a Java Swing application, and it gets packaged using JPackage for Linux, Mac and Windows. That means I have native installers for the application.

Now there are users who need to run the application with additional system properties. For example FlatLAF can be customized like this - see https://www.formdev.com/flatlaf/system-properties/

So the question is: After a jpackage packaged installer has executed, what can a user do to run the application with specific system properties?


Solution

  • Since JDK19 jpackage supports override location of cfg files. You don't need to edit the installation directories which risks being overwritten on next install. However you do have the problem that the next installation might add changes that your users need to copy to their override cfg file.

    See JDK-8287060 Allow per-user and system wide configuration of a jpackaged app

    For example on Windows you would copy and edit the config to here:

    %LOCALAPPDATA%\YourAppName\LauncherName.cfg