permaculture playing cards*
The moose likes Java in General and the fly likes automatically updating application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "automatically updating application" Watch "automatically updating application" New topic
Author

automatically updating application

Jack Donahey
Greenhorn

Joined: Sep 01, 2012
Posts: 4
Hi.
I'm developing application that has to automatically update.
Now it works as a windows service (using prunsrv http://commons.apache.org/daemon/procrun.html )
I'm wondering if you have any ideas that will help

the plan is much about:
1. application downloads update package
2. application runs update package and ends itself
3. update package do update (java classes or maybe a script ? )
4. update package ends and starts application (starts windows service)

using java during update is easy/comfortable ? or maybe some kind of scripts? BeanShell? (i don't want to learn a new scripting language - i don't have a time for this )
are there any advantages of using scripting languages? (over plain java)
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 7032
    
  16

Jack Donahey wrote:I'm developing application that has to automatically update.

I'm afraid that covers a multitude of sins. If it's for a desktop system, the easiest is to just wrap the jar in an installer (there are plenty out there), have a notification system for new releases or bug-fixes, and let the user do it themselves.

I'm certainly no expert on this, but I suspect that true real-time auto-updating might be a very tricky business, so before you embark on such a project, I'd ask yourself whether you really need it .

Winston


Isn't it funny how there's always time and money enough to do it WRONG?
Artlicles by Winston can be found here
Jack Donahey
Greenhorn

Joined: Sep 01, 2012
Posts: 4
well...thanks for help

it was quite easy.
downloading package (zip), unpacking, setting up variables for package (like paths), launching updater
updater move/copy/delete files, makes backup, updates properties and launches application (windows service) at the end
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 7032
    
  16

Jack Donahey wrote:it was quite easy.
downloading package (zip), unpacking, setting up variables for package (like paths), launching updater
updater move/copy/delete files, makes backup, updates properties and launches application (windows service) at the end

So, basically a manual update...yes?

Winston
Jack Donahey
Greenhorn

Joined: Sep 01, 2012
Posts: 4
no, fully automatic.

application checks for update, downloads package, unpacks itp and then launches it.
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 7032
    
  16

Jack Donahey wrote:application checks for update, downloads package, unpacks itp and then launches it.

And presumably it then also takes care of any existing running threads. So, does it:
(a) restart them all?
(b) inform the app that it has "refreshed" - in which case what does the app itself do?
My assumption is that any thread that has been "refreshed" could be running with a stale version of an existing class; although how critical that is may well depend on the type of update.

Winston
Jack Donahey
Greenhorn

Joined: Sep 01, 2012
Posts: 4
application runs update package in a new JVM
new JVM stops windows service (the application), updates files and then starts windows service (the application)
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: automatically updating application
 
Similar Threads
Java Swing/Awt tray application as windows service in windows Vista/Windows7
how to automatically lunch my app when windows boots?
difference between applet & application.
Tomcat as Windows service - I can't set more than 768 Mb of memory
Windows Service for Java