When I run a java program, with classpath to a remote jar on a really slow network, it takes a while to load the classes (that is okay).
But if I run the same program again just seconds after, the classes will be loaded immediately. Does that mean, the classes are cached on a disk in the java's cache directory?
Strangely it only works, if I re-run the application until 20 seconds or so. Which also makes it difficult to search for the cached classes on the disk to prove my thought.
I did some network data profiling though. Only the first (slow) run actually downloads the classes from the remote disk.
If there really is some class caching, could anyone point me to some documentation on it?
Ondrej Homola wrote:... causes the file to be loaded via the network evey time, so the caching doesn't take place. Shouldn't the OS cache both the File and the .jar in the same way?
I guess that files on the network will not be cached in memory by the operating system, because (unlike files on the local harddisk) the operating system does not have full control over them - some other computer may change the file anytime.