Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Implementing a JavaFX application auto update feature

Tags:

I'm about to write a new cross platform application, and I choosed JavaFX, mainly because of its rich UI libraries (both standard and third party) and it native data binding feature. My application will be deployed via native packaging, both because the lack of PPAPI Java plugin (Chrome will discontinue NPAPI in Chrome 42, which is in beta now) that would prevent an user with Chrome to use WebStart, and because a more "classic" user experience, so WebStart and automatic updates are off the table.

The scenario would be the following:

  1. Application starts and checks for updates
  2. If updates are found, download them and put them in a temporary folder
  3. At application shutdown, write the newly downloaded JAR files over the old ones
  4. Automatically restart the updated application

However, a few question arises in my mind (initially these two, but I could be updating this question as soon as I have more):

  • Is it safe to do so? Am I risking that somehow the JVM gets crazy if I overwrite some of the JARs already used in the application lifecycle?
  • I'm struggling to find a way to automatically restart my JavaFX application. Is it even possible?

Thanks everyone for your help.

like image 636
Claudio Mezzasalma Avatar asked Apr 08 '15 15:04

Claudio Mezzasalma


People also ask

Which JavaFX application life cycle?

start() − The entry point method where the JavaFX graphics code is to be written. stop() − An empty method which can be overridden, here you can write the logic to stop the application. init() − An empty method which can be overridden, but you cannot create a stage or scene in this method.


1 Answers

Take a look at GetDown or UpdateFX. It implements a bootstrap downloader that checks for updates, downloads them and starts your Application as soon it is updated

like image 79
keuleJ Avatar answered Sep 20 '22 12:09

keuleJ