Can I have more than one executable file with JavaFX native building tool?

半腔热情 提交于 2019-12-10 12:46:50

问题


I'm using the JavaFX Gradle plugin to build my JavaFX application. Is it possible to have more than one executable built with different main classes? If so, how?


回答1:


This is possible, as the underlying javapackager does support this.

As I'm understanding you correct, you have a project, where you have multiple entry-points and now you want to create native launchers/binaries for each of that entry-point. This is called "secondary launcher" inside the gradle plugin and even inside the javapackager.

To create multiple executables with the same bundle, just add this inside your buildfile:

jfx {
    // ... normal configuration ...

    // your secondary entry points, each will create a native executable (and one .cfg-file for each)
    secondaryLaunchers = [
        // second executable
        [
            appName: 'somethingDifferent'
            // will create the same executable, just with a different name (so this is demo-purpose only)
        ],
        // third executable
        [
            appName: 'somethingDifferent2',
            // specify your different entry-point
            mainClass: 'your.different.entrypoint.MainApp'
            // other possible entries: "jfxMainAppJarName", "jvmProperties", "jvmArgs", "userJvmArgs", "nativeReleaseVersion", "needShortcut", "needMenu", "vendor", "identifier"
        ]
    ]
}

Disclaimer: I'm the creator of the JavaFX Gradle plugin ;)



来源:https://stackoverflow.com/questions/46448239/can-i-have-more-than-one-executable-file-with-javafx-native-building-tool

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!