Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to automatically upgrade a Java application during its startup?

I have a Java 1.6 application deployed on several machines (~ 30), and started as a Windows service.

My main problem concerns the maintenance of these deployed artifacts: if I develop a new version of this application, I don't want to manually redeploy it on every machine.

Ideally, when the Windows service is starting, it checks on a remote server if an update exists, and if it is found, then it upgrades the application. Note that it is acceptable that after this upgrade the service requires to be restarted again.

This mechanism can be compared to the Maven snapshot verification: if there is a newer version of a SNAPSHOT version on a remote repository, then Maven download it before running it. Note that the application itself will be deployed on a Maven repository (in our case Nexus), so the check for an update will be done against this Nexus instance.

What are my technical solutions to implement such an automatically application update?

Do not hesitate to ask me more details about technical information or about the context...

Thanks.


Edit: As stated by Peter Lawrey, I can use Java Web Start. However, how can I integrate JWS within a Java application that is run as a Windows service?

like image 565
Romain Linsolas Avatar asked Jan 31 '12 13:01

Romain Linsolas


2 Answers

I would look at Java Web Start

like image 113
Peter Lawrey Avatar answered Nov 01 '22 18:11

Peter Lawrey


A common technique for this is to use a launcher. The steps are something like this:

  1. Start the launcher.
  2. The launcher checks to see if the application should be updated. If yes, the launcher updates the application (I think of this as "the update step").
  3. After the update step, the launcher runs the application.
like image 21
DwB Avatar answered Nov 01 '22 17:11

DwB