0

I have a Java FX Project building with Maven and use the FXLauncher https://github.com/edvin/fxlauncher to enable auto updating the application. Native installers are created using the javapackager https://docs.oracle.com/javase/8/docs/technotes/tools/unix/javapackager.html deploy command.

I want the FXLauncher to start in headless mode. According to the documentation this is done starting the fxlauncher with the corresponding command on command line:

java -classpath fxlauncher.jar fxlauncher.HeadlessMainLauncher

The problem I am struggeling with is that I can't figure out reading the javapackager documentation how to configure the deploy comand to create an executable starting the fxlauncher this way. Any ideas?

Thank you

bj03rnv0ss
  • 81
  • 1
  • 3
  • Maybe your want to check the [javafx-maven-plugin](https://github.com/javafx-maven-plugin/javafx-maven-plugin) and just set the `fxlauncher.HeadlessMainLauncher` as the mainClass. – FibreFoX Apr 23 '17 at 11:16
  • Hello @FibreFoX thanks for your response. I already tried using the javafx-maven-plugin to create my native bundles before i switched to the javapackager. Unfortunately the FXLauncher requieres to execute some steps (creating and embedding manifest app.xml in the fxlauncher.jar file) after creating the application jar and copying the dependencies and before creating the native bundlers. The jafafx-maven-plugin does not support executions to do that. – bj03rnv0ss Apr 24 '17 at 15:26
  • I have checked the documentation from that fxlauncher-project: you are right, there is no support for that project, and as there is some "ugly magic", I doubt this will ever be included. – FibreFoX Apr 24 '17 at 16:38

2 Answers2

0

I was able to answer this question thanks to the author of FXLauncher himself:

Right now you would have to change the Main-Class parameter of META-INF/MANIFEST.MF to fxlauncher.HeadlessMainLauncher inside fxlauncher.jar before you deploy your app.

If you want to make this into an execution step it would probably look like:

<execution>
    <id>configure-headless-launcher</id>
    <phase>package</phase>
    <goals>
        <goal>exec</goal>
    </goals>
    <configuration>
        <executable>jar</executable>
        <workingDirectory>${app.dir}</workingDirectory>
        <arguments>
            <argument>uef</argument>
            <argument>fxlauncher.HeadlessMainLauncher</argument>
            <argument>fxlauncher.jar</argument>
        </arguments>
    </configuration>
</execution>

Put it in pom.xml after the embed-manifest-in-launcher step.

bj03rnv0ss
  • 81
  • 1
  • 3
0

Simply modify the main class in /app/<app-name>.cfg. This is where you can configure commands for any javapackager packaged application.

Mordechai
  • 15,437
  • 2
  • 41
  • 82