So I\'ve been looking high and low for an answer to this and obviously haven\'t found a satisfactory answer.
The problem is that I want to update a JAR (or any file
This previous discussion shows some Java source code for updating a zip (or jar) file.
It's not entirely clear to me whether this will actually be any faster than using jar -u, but at least you should be able to adapt that code so that you don't have to recreate the file structure on disk.
Edit: Here is the documentation on the 'jar' utility - you can see for yourself that the particular behavior that you're looking for, while it would be useful, isn't there.
I think that the reason is that the command-line interface is basically a clone of the Unix/Linux 'tar' command. Of course, it produces zip format, rather than tar.
Edit #2 - It occurred to me that to add a file to a zip, you'd just have to strip off the central directory from the end of the file, append the new entry, and then re-write the central directory. An update would be the same thing, except instead of adding the entry to the directory, you'd update the existing directory entry to point to the new zip entry.
While exploring this possibility, I found that Java 7 includes a zip file system provider which looks like it does this, and could form the basis of a solution for what you want to do.