javajavafxwindows-installerjpackage

JPackaged App Start MSI Installer and then System.exit()


I have a JPackaged JavaFX app that reads a github repo's releases to retrieve updates. When an update it found, it downloads the new .msi file and runs it. However, if I run the MSI without exiting the application completely (Such as Platform.exit()) the installer doesn't work properly, as there is an application running in the directory that it's trying to install to. I am FORCED to use System.exit() to close the app.

The further issue with that is that I have tried using both Runtime.exec() and ProcessBuilder, but both of those get shut down when the app is closed via System.exit().

How do I run a task/process (msiexec) from a Java app, and then close the Java app with System.exit(), without ending the external process?


Solution

  • From Slaw's comment:

    There was a regression in version 21.0.2 where exiting the Java process also kills any forked child processes. Looks like it's fixed in version 23, though there are some backports to 22.0.1 and 21.0.4-oracle (other vendors probably also have the backport for 21.0.4). Of course, none of those versions are released yet. You could instead try an older version of jpackage.

    I confirmed that the issue resided in jpackage itself, and rolling back to 17.0.7 fixed my problem.