How do I make a Java app self-update?

后端 未结 5 1116
抹茶落季
抹茶落季 2020-12-29 04:18

Problem: I have a standalone Java app (henceforth known as \"the agent\") that runs as a service on internal company servers. It acts as a remote agent for

5条回答
  •  不知归路
    2020-12-29 04:53

    No need for wrapper (save memory) or java web start (adds more restrictions on your application), simply let a thread in you application check periodically for updates (e.g. from cloud) and download updates if available, then code these two calls in you application:

    1. launch a shell script (.sh or .cmd) to update your artifacts and launch your application after few seconds pause in the script(to avoid having two instances of your application at the same time).
    2. Terminate your application (first instance)

    The script can overwrite needed artifacts and re-launch your application.

    enjoy !

提交回复
热议问题