eak12913
eak12913

Reputation: 303

Package multiple javaFX apps into one native package

High level: I am working on a JavaFX app that I'd like to automatically update

Things I've looked at:

Issue I am having: Trying to package two separate javafx native executables into one package.

Description: I have created a JavaFX UI application that checks for an updated version upon startup. The application is delivered by building a native (using jfx packager) package for each OS: Liux, Windows and OSX.

If there's a newer version available the app downloads the required update into a temporary folder.

To update itself, the app technically needs to overwrite some of its own files. While this is possible to do on Linux and OSX, Windows locks all of the jar files that I need to update while the main application is running.

To get around this, I created a small "updater" application that I would download. My main application would download all of the updates AND the updater application. The main application would then launch the updater and kill itself.

The updater would continuously try to update that application files (this was in some kind of loop in case it took a while for the main application to shut down).

Once the updater would finish, it would simply call the correct main program's executable file and the update would be completed.

This works...BUT: In order to run my updater application, I am relying on the client's machine having java (and having the correct version to boot). The whole point of using the javafx native packager is to make sure that the JRE is distributed with the app and that there is no dependency on any local version.

I wanted to try a hack:

The hack only works on OSX - on both windows and linux there are local config files that the executable relies on to invoke the correct java file.

Is there any way to get around this issue? Is there any way to force the packager to output a custom "package.cfg" (in the case of windows) that would allow me to bundle two executables?

I realize this is a long shot, but any advice would be appreciated.

Upvotes: 2

Views: 581

Answers (1)

eak12913
eak12913

Reputation: 303

I may have asked my question just a bit before the code to do what I wanted was included in javapackager.

Short story is that this is now possible to do using javapackager that is part of JDK 1.8 release > 60 (I am now using 74)

Here's a link to the official oracle documentation: Oracle Doc

It's also possible to use Maven to build your JavaFX app to have secondary launchers via: javafx-maven-plugin

Upvotes: 1

Related Questions