• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java to update jar files

 
Dennis Putnam
Ranch Hand
Posts: 359
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Kemal Sokolovic
Bartender
Posts: 825
5
Java Python Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java Web Start?
 
Dennis Putnam
Ranch Hand
Posts: 359
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Dennis Putnam
Ranch Hand
Posts: 359
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Joel McNary
Bartender
Posts: 1840
Eclipse IDE Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As far as I know, there is no requirement for ActiveX for Java WebStart. The WebStart documentation states that The client machine requires support for the Java Runtime Environment (JRE), version 1.3 or later. Java Web Start is available for Windows 98/NT/2000/ME/XP, the Solaris Operating Environment, and Linux..

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.
 
Paul Clapham
Sheriff
Posts: 21322
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic