Hello, i want to develop a desktop application probably using swing. But i would like to update the software from a remote server, even while it is working. When there is a new version ready system will prompt user and application will go to a kind of maintenance state. Then after loading the updated parts of the application from server, user will be able to work again. (or application will be rebooted automaticaly.) I am aware that there are some component based frameworks (avalon, picocontainer, carbon) but i am very confused how to choose, or use them. Can anyone give me some suggestions, or point me some applications with these capabilities? Thanks in advance.
If application need only check new version existance, then load new version, and restart it's simple. But if you want to update it without restart application, it's difficult - really I don't know how you can UNLOAD class, and the LOAD it (new version) again. But I think exists other way. For example you don't change interface to use some class, than make all calculation, and wish to change it without reload application. So you can call previous version of class using reflection, and for example previous class name was Calc_v100. Now you have Calc_v101. You copy it into your classpath. So you can pause calculation , and create new instance of class Calc_v101 (using reflection), and continue to use the updated module. If obsolete class and new class implements the same interface, or overload the same base class, it can work (in some JVM)
thanks for the answer, since there are complications, i will go for the easy way. I mean restart after updating the software. But letme clarify again how the application will work. - Whenever a new new update exists, client will be notified and download the new files - After finishing system will force to restart application. Also can this restatrt operation be automated without any user intervention? What is the best way of doing this? is there a ready to use framework or such? or should i make a kind of "pluggable" interface and some components using those interfaces?
Probably best solution using WebStart (see javasoft.com) Before each run, it test if exist updated version. User should restart the application each working day. For 95% cases it's good solution. If it isn't enough, you can add such check periodically (for example each hour), and if exist update show to user pop-up window with explanation, that it should restart appl. [ December 22, 2003: Message edited by: Igor Ko ]
Webstart is a very good option but if you can't don't want to do Webstart, it's pretty easy to do yourself. I rolled my own solution to this for the apps I have written. I'd be more than willing to share my experiences and even the code to do it. For mine, though, if there is a new version, I let the user know and give them a link to download the new version. If they want the new version, they click the link and downlaod it. Most people dislike programs that update themselves. If you need any hints/pointers, let em know. Brian
Yes, i agree that people dislike updates, but in my case updates will be mandatory in some cases. One other problem is, i only want to update the changed modules for making download faster. Posibly i need some kind of plugin mechanism with a class loader. Also i am planning to use Java service wrapper for restarting the application automatically after the update finishes. if you tell some about your code i would be happy. by the way, your applications look cool. i am also not ignoringthe java web start but since i will use JNI and local file system access, it may cause some trouble.
It means our mission is in jeapordy! Quick, read this tiny ad!
Free, earth friendly heat - from the CodeRanch trailboss