4 Replies Latest reply: Feb 12, 2013 4:34 AM by jugen RSS

    Use a Preloader for auto updating application?

    921640
      Hi,

      Does it make sense to use a preloader for auto-updating purposes? I've never done anything like this before, so I was thinking to do something like this during the start up in a preloader:

      1. check whether there is a new JAR somewhere on the Web (via FTP, last modified date),
      2. if there is, ask the user whether she want's to update,
      3. overwrite the old JAR with a newer one,
      4. restart the application.

      Now, is this possible? Are there some other, better ways, I'm not aware of?
        • 1. Re: Use a Preloader for auto updating application?
          jsmith
          Preloaders are currently only implemented for webstart and browser embedded app deployments (which is kind of strange in and of itself, I guess preload support for standalone apps may be added at some future stage).

          A lot of browser embedded apps are pretty simple so you would want them always updated, which is the default behaviour of the browser plugin if I'm not mistaken, or you could host multiple version urls and just let the user point to the one they want.

          Webstart apps already include an autoupdate mechanism - so if you are deploying via webstart see if you would like to make use of that first before creating your own. Google will find are resources which describe this mechanism on the web.

          http://docs.oracle.com/javase/7/docs/technotes/guides/javaws/developersguide/syntax.html#update

          It would be nice to have an intellij idea style update and patch system for standalone apps . . . idea community edition is open source so perhaps you could look and see how they do it - but it still seems like quite a bit of work to implement well yourself.
          • 2. Re: Use a Preloader for auto updating application?
            921640
            I'm a little confused now. I am developing a standalone app, and I've implemented an preloader that works just fine. Actually, no, sometimes it hides itself even before it had a chance to be shown, but that is because some computers are simply faster than others. So, in a way that is a desired behavior. :)

            What I'm concerned about is can I overwrite my current app's JAR if it' preloader is started? I guess not, if it's really started, OS wouldn't let me.

            The idea I have is pretty simple: check if there is newer JAR, download it, and use it. But I'm not sure I can implement it...
            • 3. Re: Use a Preloader for auto updating application?
              jsmith
              I am developing a standalone app, and I've implemented an preloader that works just fine.
              Guess my info was out of date and preloaders can be used with standalone applications - sorry for the confusion . . .
              What I'm concerned about is can I overwrite my current app's JAR if it' preloader is started? I guess not, if it's really started, OS wouldn't let me.
              Usually preloaders are deployed in a seperate jar from the rest of the application. I'd guess if the preloader could check to see if the app's current jar is up to date before it starts initializing the application using classes from the application jar, then it could pop up a prompt to let the user there is a new version available, ask them if they want to use it, and if so, fetch the new version of the application jar before it continues with application initialization.
              But I'm not sure I can implement it...
              Yeah, I have faith . . . I am sure you can implement it ;-)
              • 4. Re: Use a Preloader for auto updating application?
                jugen
                Did you ever get this right ?