views:

175

answers:

2

Every time we update our Java application (Java client and Java server) we have the problems that some clients approx. 1% - 2% does not load the new jar files. This occur with applets and also with Java Web Start. If you clear the Java Cache then all is working correct.

Any idea why Java does not check for new jar files on every start?

+2  A: 

This can be problematic to resolve but there is an easy workaround for this. Instead of relying on correct cache-update, just make sure that JAR file names include version / build number of the application. JAR files for new version of applet will then effectively live on other URL (you also have to change the bootstrap web-page).

Matej
Wouldn't this cause other strange problems?
asalamon74
Absolutely. The JNLP is also cached and therefore subject to the same problems, and you're changing it with every release to include the new version numbers. This might improve reliability but I'd bet it's still not 100% effective.
banjollity
I can vouch for there being issues if the JNLP file is cached. Sometimes I randomly find myself clearing the Firefox cache to fix some odd webstart error.
Mark
+1  A: 

I've been there and the only solution which is 100% guaranteed to work is to have a different path/url to your resources(jars, images, etc). Nobody can guarantee that cannot be bugs in the caching mechanism(if you look in the JDK change list every 2-3 releases there is something related with caching mechanism of jars) .

So go with that(just append last modified time as string at the end of the jar url) and you will not have any problems:

Ex : http://myserver/applet/codebase/your_jar.jar?v=2487387543434 and next version it will be http://myserver/applet/codebase/your_jar.jar?v=343438534545455 <- this is jar's last modified time.

adrian.tarau