Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to force a Java Applet to Load out of Cache

My friend and I are developing a little game and we want to share the development stages with our friends. So I made this little page http://people.scs.carleton.ca/~manders8/game.html

Right now it's one .class file that we're updating. But for some reason it always loads the old version. I know there's a way to turn off java caching but my friends aren't that competent. Plus to get people to play your game it should super easy and not requiring like 5 steps with screens shots just to try it out.

I have this is the tag:

<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="no-cache">
<meta http-equiv="Expires" content="-1">
<meta http-equiv="Cache-Control" content="no-cache">

Because I thought it might be browser related but that doesn't help.

This is my code

<applet code="com.murderbody.prototype.TitleScreen.class" codebase="http://people.scs.carleton.ca/~manders8/content/" width=640 height=380></applet>

Changed from applet to:

<object type="application/x-java-applet;version=1.5" width="640" height="380">
     <param name="codebase" value="http://people.scs.carleton.ca/~manders8/content/">
     <param name="code" value="com.murderbody.prototype.TitleScreen.class">
     <param name="cache_option" value="no">
</object>
like image 360
Uri Avatar asked Nov 23 '10 21:11

Uri


2 Answers

Add this inside your Applet tag: <param name="cache_option" value="no">

Speaking of Applet tags, they've been obsolete for years; consider using the object tag instead.

like image 60
Powerlord Avatar answered Sep 28 '22 08:09

Powerlord


The caching of Java applets may happen at two levels: the browser and the Java plugin. Your problem seems to be with the plugin. I just found this:

http://java.sun.com/products/plugin/1.3/docs/appletcaching.html

One approach some people use is resource versioning, i.e. generate a new applet filename for each version (better if you package the applet in a jar file and rename the jar for each new version, e.g. titlescreen-1.2.23.jar). If you have a decent build tool (ant, maven) that can automate this renaming for you, both at the JAR and tag level, the better.

like image 32
Carles Barrobés Avatar answered Sep 28 '22 06:09

Carles Barrobés