Google uses bsdiff and Courgette for patching binary files like the Chrome distribution. Do any similar tools exist for patching jar files?
I am updating jar files remotely over a bandwidth-limited connection and would like to minimize the amount of data sent. I do have some control over the client machine to some extent (i.e. I can run scripts locally) and I am guaranteed that the target application will not be running at the time.
I know that I can patch java applications by putting updated class files in the classpath, but I would prefer a cleaner method for doing updates. It would be good if I could start with the target jar file, apply a binary patch, and then wind up with an updated jar file that is identical (bitwise) to the new jar (from which the patch was created).
Try the javaxdelta project on Sourceforge. It should allow to create patches and to apply them.
[EDIT] This tool doesn’t exist, yet. Open the JAR file with the usual tools and then use javaxdelta to create one patch per entry in the JAR. ZIP them up and copy them onto the server.
On the other side, you need to install a small executable JAR which takes the patch and the JAR file as arguments and applies the patch. You will have to write this one, too, but that shouldn’t take much more than a few hours.