I have a java application that is distributed to the public. When the user starts the application it checks my web site for the latest version and if there is a newer version then the app downloads the JARfiles and places them in the appropriate locations. BTW: this is a cross-platform app that runs on Windows, Mac OSX and Linux. All this works so my question is this. Once the download of the new JARs is complete, how to I tell my application to stop itself and then relaunch automatically.
Paul, Thanks for the tip. I'm going to try this today and let you know how I make out. I have command line parameter I need to pass to the JVM but it looks like Runtime.exec() will allow that. I just need to figure out the syntax. Thanks again.
Rob, Thanks for the tip but I don't know if Java Web Start will help. I don't know enough about it but though my app is downloadable from the web it isn't a web app. It is a desktop app that don't require an internet connection to run. If an internet connection is available it does check for updates but if the connection isn't there it bypasses the check and runs as a local app. Does that fit with the Java Web Start scheme? The app lives on the user's local machine.
Harry Harding wrote:I don't know enough about it but though my app is downloadable from the web it isn't a web app. It is a desktop app that don't require an internet connection to run. If an internet connection is available it does check for updates but if the connection isn't there it bypasses the check and runs as a local app. Does that fit with the Java Web Start scheme? The app lives on the user's local machine.
Yes, that fits with the Java Web Start scheme. A Java Web Start application is an app that's usually downloaded and installed from the web, but once it's installed it runs just like any other Java program on a user's local machine. Java Web Start provides a mechanism to do exactly that what you describe: check if there's a newer version on the web, if no then run the currently installed version, otherwise download the new version, install it and run that.
Using Java Web Start does not make your application a web app.
You seem to have the requirement that the application should check every 25 seconds (or some period) to see if there's a new version available, and to update itself on the fly if there is. Is that correct?
Java Web Start doesn't do that. All it does is to check when the application is started for new versions, and download the new version before starting the application if there is one. Generally that's sufficient for most applications, and it works fine if that's what you need.
Rob Prime wrote:Try starting here. To be honest I haven't used it before so I can't tell you if it caches the versions so you can run them locally.
Yes, you can run Web Start applications on your machine without access to the host they came from. I believe there's an option to prevent that from happening, but it's a normal operating mode for Web Start.
Joined: Mar 18, 2010
Thanks all for the advice. Paul, I'm sorry if I was not clear. No I do not have any specific update frequency constraint (25 secs), checking at the start of the app is fine and actually preferred so it sounds like Java Web Start is the answer to my problem. Now all I have to do it learn how to use it. Thanks for the link Rob, I'm going to check this out before I bother you all again.
Also, BTW: Thanks for making a newcomer feel welcome. I think I may have found a new home.