I have an applet shown in a webpage with
<applet code="foo.class"></applet>
When i change the foo.class file in the server and access the page, it shows the older version. If I empty both browser and jvm caches, and then reload the page, it shows the current version. How can I tell the browser/jvm that this is another version of the same class?
And, if I access the html file locally, without any webserver, it shows always the current version even without cache refresh. What am I missing?
update:
when loading the applet with js, the generated html is:
<applet code="abcSynth.class" archive="miglayout-4.0-swing.jar" height="500" width="800">
<param name="cache_option" value="no"><param name="codebase_lookup" value="false">
Now, I found in java docs that codebase_lookup it's used when the main class is not provided with the .jar archive, just like this case. With false value, it throws ClassNotFoundException, with true value it starts (the old version). The code folder contains main class and other few .class files, the only .jar is the miglayout.jar, but since javadocs says "Typically applets are deployed with all the needed classes and resources stored in the applet JAR files." I wonder if I'm doing something wrong about .class/.jar depolying.
SOLVED Thanks it worked! Browser is still holding the older version in cache but after restart it shows the current version!
Final code I used is:
<object classid="java:myClass.class"
type="application/x-java-applet"
archive="myJar.jar"
height="500" width="800" >
<param name="code" value="myClass.class" />
<param name="persistState" value="false" />
<param name="cache_option" value="no"/>
<param name="codebase_lookup" value="true"/></object>
<applet code="foo.class"></applet>
" I am surprised you see anything given that applet specifies nowidth
orheight
. Validate the HTML. 2) The browser/JRE caches applet classes. Flush the cache by typingc
(?) in the Java Console. Then reload the page. 3) As more general advice, test applets as far as possible in the IDE and applet viewer. Prefer a JWS launched app. to an applet. – Andrew Thompson