22

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.

Claudio Mezzasalma
  • 646
  • 1
  • 5
  • 23
  • 3
    You could create a second updater application which checks if there is a new version, updates the files if necessary and then launches your application. – Klaus Eckelt Apr 09 '15 at 14:05
  • 1
    That's the way I'm currently exploring, by looking more closely to the JavaFX Preloader that could result useful in this scenario. – Claudio Mezzasalma Apr 09 '15 at 14:10

3 Answers3

7

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

keuleJ
  • 3,418
  • 4
  • 30
  • 51
  • 2
    Thanks for your suggestions. Unfortunately it seems that neither GetDown nor UpdateFX addresses my needs: - UpdateFX: it seems it needs the app in a single JAR, while I have some library that I'd like to carry around as separate JARs; - GetDown: it seems pretty Swing-oriented, and I'd like to mantain a pure JavaFX course. – Claudio Mezzasalma Apr 09 '15 at 12:56
3

I've recently created update4j which works with Java 9's module system and meets your requirements.

Mordechai
  • 15,437
  • 2
  • 41
  • 82
  • it seems to be hard to implement, tried many times, no success. Also, the documentation lacks a lot of explanation – FARS Dec 10 '21 at 13:53
  • https://www.reddit.com/r/ProgrammerHumor/comments/ma13ye/comment/grpyne1/ – Mordechai Dec 10 '21 at 16:04
  • it gets so hard when working with spring, for some reason not even the demo app works. I'm even willing to pay for its implementation – FARS Dec 10 '21 at 16:42
  • Did you run into a specific exception? – Mordechai Dec 10 '21 at 17:10
  • Nop, my problem is more related to all of my questions about its implementation, how things works, etc. I tried to make my code as similar as the demo application code, but at some steps it's so hard to guess what has to be done. As example, while creating the config, should I create a .file(FileMetadata.readFrom for every jar in my project? How should I setup the remote server? An explanation video or someone to look over my code would be awesome, that's why I'm seeking out some assistance. I want to implement it, but it's hard to determine what has to be done only with the current resources – FARS Dec 10 '21 at 17:38
  • are you available to collaborate? I would love to have your assistance. If you're interested, please leave your contact or send me a hello in my email: felipeaumann@gmail.com. If we succeed in making it work, I can even produce a video showing how update4j work! – FARS Dec 10 '21 at 19:27
  • Will see if I find a moment – Mordechai Dec 10 '21 at 20:49
2

Perhaps you can try install4j though it's paid. The main feature here that I love the most is the auto update and the way you can configure the installer in an easy way (create Linux - deb,rpm installer, Mac and window installer) and can even package the required jdk version to run your app (this means your users do not need to have that java version installed first before using your app)

Though, it might seem a bit overkill foe your needs

Kiong
  • 798
  • 1
  • 8
  • 28