Skip to content

Conversation

alchitry
Copy link

@alchitry alchitry commented Sep 7, 2023

For my application I need the installer to include two launchers with different arguments. It turns out JPackage supports this so I added support to add the necessary flags.

WIth this addition, you can specify additional launchers in the nativeDistributions block like this.

compose.desktop {
    application {
        mainClass = "com.alchitry.labs.MainKt"
        nativeDistributions {
            targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
            packageName = "Alchitry Labs"
            packageVersion = (version as String).split("-").first()
            vendor = "Alchitry"

            additionalLauncher("Alchitry Loader") {
                add("arguments","loader")
            }
        }
    }
}

You pass arguments to add to the properties file through the add function.

Here's the relevant doc for the add-launcher flag.

--add-launcher name=path
Name of launcher, and a path to a Properties file that contains a list of key, value pairs

(absolute path or relative to the current directory)

The keys "module", "main-jar", "main-class", "description", "arguments", "java-options", "app-version", "icon", "launcher-as-service", "win-console", "win-shortcut", "win-menu", "linux-app-category", and "linux-shortcut" can be used.

These options are added to, or used to overwrite, the original command line options to build an additional alternative launcher. The main application launcher will be built from the command line options. Additional alternative launchers can be built using this option, and this option can be used multiple times to build multiple additional launchers.

@amir1376
Copy link
Contributor

amir1376 commented Apr 10, 2024

i also need that feature.Thanks

@ghost
Copy link

ghost commented Nov 1, 2024

i also need that feature.Thanks

It's been over a year, so it looks like we won't be able to wait for this for a while

@alchitry
Copy link
Author

alchitry commented Nov 1, 2024

I ended up using Hydraulic Conveyor which has been excellent.

@kwstasch
Copy link

kwstasch commented May 7, 2025

Hello update please;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants