How do I upgrade to jlink (JDK 9+) from Java Web Start (JDK 8) for an auto-updating application?

后端 未结 3 442
渐次进展
渐次进展 2021-02-02 06:13

Java 8 and prior versions have Java Web Start, which auto-updates the application when we change it. Oracle has recommended that users migrate to jlink, as that is the new Orac

3条回答
  •  爱一瞬间的悲伤
    2021-02-02 06:30

    Do you use maven?

    I've resolved my similar problem with maven (I need to update an EAR).

    My main app (the ear package) has a pom.xml with listed the dependencies and repositories.

    The dependencies have the tag with a range (documentation) as in this example

    [1.0.0,)
    

    That means : get version 1.0.0 or newer of the dependency. (You can put also an upper bound to the version, [1.0.0, 2.0.0) so if you develope a new version, it is not used in old app)

    In the repository section I added my personal repository.

    Now, in the remote machine I need only to rebuild my ear package with maven : the compiler download the newer version of my jar and put it together.

    You need a system to check if there are newer dependencies version and warn the user to update the app and also lock its work (you can't work if you don't update). Maybe you need a little app to make users do the rebuild process easily. It's 1990's but a lot of desktop-app works in this way

    PRO

    • This schema can be used in a lot of different projects.

    CONTRO

    • You need to build the app in the remote machine, so the client must have a JDK and access to your repository (like artifactory);

    • You must write code in different jars and add them like dependencies in the main archive.

    • You must change JAR version each time and publish on the repository (this could be a good practice)

提交回复
热议问题