Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

how to clear a cached ZipFile

843798Nov 12 2006 — edited Nov 12 2006
When you read a ZIP or JAR archive using the ZipFile or JarFile class, its contents are cached. As a result, if you read the archive once, make some changes to it on disk and then read it again later, you may get the original contents rather than the updated contents. I know you can get around the problem by using ZipInputStream rather than ZipFile to read the archive, but that does not help if you need random access to the ZIP contents, not linear access.

So, is there any way to clear the cache of a ZipFile, to force it to read the archive from disk, short of restarting the JVM?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 10 2006
Added on Nov 12 2006
2 comments
406 views