javaclasspathjpackage

How to update a jpackage installed application?


I have a jpackage created application that consists of a single application jar file plus some third-party dependencies. With jpackage I create installers for Linux, macOS, and Windows. All works well.

But I don't want my users to have to reinstall the application every time my application changes, so I'm looking for a way to let the user download the application jar and have that replace the one that was included with the installer.

I think the best option would be for the application jar to be downloaded into a $HOME/application_name/ directory and set the installed application's CLASSPATH to have that directory at the beginning, so that it finds the newly updated jar before the one that came with the installation. Is this possible? If so, how? I can't find anything in the jpackage documentation to suggest that capability exists. Alternatively, is it possible to directly replace the installed application jar from within the application? If so, how?

If neither is possible, is there another way? In 2+ years-old question about the same thing, the only answer suggested use of a JWS replacement, "getdown", but I don't want to go that route, as I'd lose the other benefits of jpackage.


Solution

  • "Don't fix what ain't broken." - Bert Lance

    Do you have any reason to use jpackage? Cause you can get the best of it with a technology I use for every desktop application I have, JDeploy:

    jDeploy is a tool for Java developers to more easily distribute their desktop apps as native bundles. You can publish your app to the cloud using npm or GitHub releases, and it provides a download page with links to download native bundles for Mac, Windows, and Linux. For more information about jDeploy and its features see the jDeploy website.

    Their website:

    [https://www.jdeploy.com/][JDeploy site]
    

    Following exactly what this doc shows allow you to do what you're aiming for:

    [https://www.jdeploy.com/docs/manual/][JDeploy developers guide]
    

    Let me know if you have any questions!