Why doesn't Java request new versions of jar files several times?

Every time we update our Java application (Java client and Java server), we have problems that some clients encounter. 1% - 2% does not download new jar files. This happens with the help of applets, as well as with Java Web Start. If you clear Java-Cache, everything works correctly.

Any idea why Java doesn't check for new jar files every time it starts?

+4
source share
2 answers

This may be problematic for a solution, but there is a simple workaround for this. Instead of relying on the correct cache update, just make sure the JAR file names include the version / build number of the application. JAR files for the new version of the applet will work efficiently on a different URL (you also need to change the boot page).

+2
source

I was there, and the only solution 100% guaranteed to work is to have a different path / URL for your resources (banks, images, etc.). No one can guarantee that there can be no errors in the caching mechanism (if you look in the JDK changes list every 2-3 releases, there is something related to the caching mechanism of the boxes).

So go with this (just add the last modified time as a line at the end of the jar url) and you won't have a problem:

Ex: http: //myserver/applet/codebase/your_jar.jar? V = 2487387543434 , and the next version will be http: //myserver/applet/codebase/your_jar.jar? V = 343438534545455 <- this is the last modified jar time.

+1
source

Source: https://habr.com/ru/post/1285756/


All Articles