Cache which java classes are in a jar when opening jar the first time during classloading

Alan Bateman Alan.Bateman at
Mon Aug 31 10:07:28 UTC 2015

On 31/08/2015 04:02, Jonathan Yu wrote:
> Hi Adrian,
> It's possible for jar files to be modified while the JVM is running - is
> there some facility for detecting that an archive was modified and thus
> invalidating the cache?
Modifying a JAR file that is in use leads to unpredictable behavior and 
can even cause crashes too (when JAR/zip files are memory mapped). That 
said, the class path can extend over time, the most obvious being when 
JAR files have the Class-Path attribute. It is possible to construct a 
cache at run-time that is package name -> the first JAR file containing 
that package but at the cost of scanning the contents of JAR files 
(probably on open). There was a lot of experiments and prototypes in the 
past along these lines.


More information about the core-libs-dev mailing list