I am planning to distribute a Java app. However, I am not finding much help on how to manage updates. I cannot simply replace the jar file as there is a resource file that is unique to each installation. Can someone point me to a tutorial that shows how to update a jar which preserves resources in the old file? TIA.
The quieter you are, the more you are able to hear.
Joined: Feb 03, 2012
Thanks for the reply. Someone suggested that to me off list but in reading through it, I'm not sure it will work. First, the application is OS independent and it appears to me that Web Start requires Active-X which doesn't normally exist on *NIX. Second, there is no web server for this. The updater would need to be standalone and emailable. Perhaps it is not necessary to do anything other than manipulate the various class files using some kind of zip archive interface. In any case I am looking for suggestions how this might be done.
Joined: Feb 03, 2012
After some thought I think I have a solution if I can figure out how to do it. The only thing I really need are the properties from the old version. How do I load properties into a jar file (the new version) from a different jar file (the old version)? TIA.
But that doesn't really solve your short-term problem. To do what you want, try looking at the java.util.zip package, particularly java.util.zip.ZipFile and java.util.zip.ZipEntry. You would need to write a separate program to do the updates, treating the Jar files just a plain old Zip files. As long as they are not digitally signed, that should be no problem.
Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
And just to clarify, as this hasn't specifically been said yet: You can't update an existing jar file. You're going to have to create a new jar file. In your case this would involve copying all of the entries out of Jar File 1 and copying selected entries out of Jar File 2, into a new jar file.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com