Creating an Automatic Update for a Java application

I am researching adding an automatic update feature to my application.

Here is the logic I have so far:

I will create a 'loader' program which on start up would check for an update. If there was no update it would load the main jar file. If the is an update it would download the update package which would contain the updated code (classes or jar file), new resource files (images,xsl) and sql scripts for updating the database. The program would then replace the jar file and images and run the update scripts on the database.

Is it possible to update certain classes that are in a jar file or would it be better replace the whole file?

Are there problems with opening one Java program from another Java program? (my 'loader' program opening my main application)

If anyone has tried anything like this before I would like some input on how you did it etc. I am currently looking into 3rd party solutions so if any one has any third party suggestions that would be great too.

[1019 byte] By [alzoida] at [2007-11-27 0:37:01]
# 1
It sounds like you are reinventing the Java Web Start wheel.
DrLaszloJamfa at 2007-7-11 22:46:46 > top of Java-index,Java Essentials,Java Programming...
# 2

The Java web start can only transfer .JAR files. I need to be able to transfer resources such as images and configuration files etc. I can not put these as resources in the Jar file because the download would be too big. Right now the updates are about 500KB. If I had to include every resource each time they downloaded the update would be 8MB.

I am reinventing the "automatic update" wheel. I am trying to get input from people who have done this before to see what is involved. I would like to know and any difficulties and problems they faced. I want some input before I decide if I will use a third party application like install shield or write my own.

alzoida at 2007-7-11 22:46:46 > top of Java-index,Java Essentials,Java Programming...
# 3

you can't just replace certain files in a jar, no. you can unpack the jar, replace the files, and re-pack it, but it's easier to just replace the whole jar. you'll have to weigh up the simplicity of replacing the entire jar with the bandwidth savings from only updating some of the files within

there are bound to be third-party packages that do this already. the only thing that springs to mind right now is Eclipse Equinox, but to make use of that you'd be looking at packaging your application as OSGi bundles, which is probably more effort than it's worth just to get this functionality, and in any case the last time I checked the project, programmatically installing updates was still not really working (might be different now). but it might be worth you getting the sources for Eclipse and having a look at how they do updates - they're not automatic, but you can fill in the blanks yourself

georgemca at 2007-7-11 22:46:46 > top of Java-index,Java Essentials,Java Programming...
# 4
If you're building your application on the NetBeans Platform you could use its autoupdate module: http://autoupdate.netbeans.org/Don't know if it exactly suits your needs though, but it might be worth to check it.-Puce
Pucea at 2007-7-11 22:46:46 > top of Java-index,Java Essentials,Java Programming...
# 5

Hi,

I need your help on the automatic code update for my project. I'm using JBoss and java program is running on Jboss server. There is another central server residing at main location. For ever week, we tune the java program and keep the latest jar file at central server. Whenever there is a new version available at central server, automatically latest jar file should be replaced in JBoss server residing at customer locations. As we know , we will not re-launch the java program running in JBoss server ( only one time). For Java Web Start, we should re-launch every time to get the latest updates.

Could you please just any solution for my problem? Thanks in advance.

Basically we are looking real-time code updates.

marutheea at 2007-7-11 22:46:46 > top of Java-index,Java Essentials,Java Programming...