This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes Java in General and the fly likes suggestion for runtime pluggable application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "suggestion for runtime pluggable application" Watch "suggestion for runtime pluggable application" New topic

suggestion for runtime pluggable application

ahmet akin

Joined: Oct 27, 2003
Posts: 14
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.
Igor Ko
Ranch Hand

Joined: Jun 24, 2002
Posts: 90
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
So you can call previous version of class
using reflection, and for example previous class name was
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)
ahmet akin

Joined: Oct 27, 2003
Posts: 14
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?
Igor Ko
Ranch Hand

Joined: Jun 24, 2002
Posts: 90
Probably best solution using
WebStart (see
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 ]
Brian Pipa
Ranch Hand

Joined: Sep 29, 2003
Posts: 299
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.

My Java Freeware:<br />MACCC - <a href="" target="_blank" rel="nofollow"></a><br />Nator - <a href="" target="_blank" rel="nofollow"></a>
ahmet akin

Joined: Oct 27, 2003
Posts: 14
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.
Consider Paul's rocket mass heater.
subject: suggestion for runtime pluggable application
jQuery in Action, 3rd edition