How to clear cache to reload applet?

M

M

Hi,

Is it true that the applet loaded into the browser will not be cleared
until I clear the cache?

I tested it in this way:
- run a html page with some applet;
- changed something in the applet and regenerate the .class;
- close the browser and reload the html page;
- the "old" .class file was the one running instead of the new one!

Is there anyway to ensure the latest .class is invoked.
Thanks
Pat.
 
G

Grant Wagner

M said:
Hi,

Is it true that the applet loaded into the browser will not be cleared
until I clear the cache?

I tested it in this way:
- run a html page with some applet;
- changed something in the applet and regenerate the .class;
- close the browser and reload the html page;
- the "old" .class file was the one running instead of the new one!

Is there anyway to ensure the latest .class is invoked.
Thanks
Pat.

Something like this might work:

<applet code="ATest.class" archive="ATest.class?v=200406181300"></applet>

I tested it in Firefox 0.9 and it loaded and ran the class. The idea here
is that when you change the class, you change the [v]ersion in the ARCHIVE
attribute. That should force the browser to get a new copy of the class
file, since the "archive" is now at a different URI, and since the
"archive" is the .class file, it might work (unless the user agent
disregards ARCHIVEs that are classes, which is entirely possible).

If you're using an <object> tag instead, you can probably achieve the same
thing by changing:

<PARAM NAME="ARCHIVE" VALUE = "/TheClass.class"> <!-- or "TheJar.jar" -->
to
<PARAM NAME="ARCHIVE" VALUE = "/TheClass.class?v=200406181300"> <!-- or
"TheJar.jar?v=..." -->

The only way to see if this works is to perform your steps above, change
the class file, change the [v]ersion and see what you get when you reload.
 
J

John C. Bollinger

M said:
Hi,

Is it true that the applet loaded into the browser will not be cleared
until I clear the cache?

I tested it in this way:
- run a html page with some applet;
- changed something in the applet and regenerate the .class;
- close the browser and reload the html page;
- the "old" .class file was the one running instead of the new one!

Is there anyway to ensure the latest .class is invoked.

I find that shutting down and restarting the browser usually works.


John Bollinger
(e-mail address removed)
 
R

Roedy Green

That should force the browser to get a new copy of the class
file, since the "archive" is now at a different URI, and since the
"archive" is the .class file, it might work (unless the user agent
disregards ARCHIVEs that are classes, which is entirely possible).

I think Applets pay no attention to the source of a class. If they
already have it loaded, they don't load it again.

You would have to change the name of the class slightly to force a
reload. In apps, you can use a new ClassLoader to allow duplicate
class names running at once.

The only thing I have found to work is exiting the browser and
restarting.
 
M

M

Well, thanks for all the replies.

I tried the "... archive="MyClass.class?v=200406180000"..." option and
it seems to work, but sometimes I need to restart browser in order to
get the latest version of applet. :<

Besides, it seems I need to specify this "archive..." stuff for every applet
to be loaded. Will it be too tedious and, is this what you guru did
in web development?

Actually, I'm using: WinXP, IE 6, JVM 1.4.2.04

Thanks.

Grant Wagner said:
M said:
Hi,

Is it true that the applet loaded into the browser will not be cleared
until I clear the cache?

I tested it in this way:
- run a html page with some applet;
- changed something in the applet and regenerate the .class;
- close the browser and reload the html page;
- the "old" .class file was the one running instead of the new one!

Is there anyway to ensure the latest .class is invoked.
Thanks
Pat.

Something like this might work:

<applet code="ATest.class" archive="ATest.class?v=200406181300"></applet>

I tested it in Firefox 0.9 and it loaded and ran the class. The idea here
is that when you change the class, you change the [v]ersion in the ARCHIVE
attribute. That should force the browser to get a new copy of the class
file, since the "archive" is now at a different URI, and since the
"archive" is the .class file, it might work (unless the user agent
disregards ARCHIVEs that are classes, which is entirely possible).

If you're using an <object> tag instead, you can probably achieve the same
thing by changing:

<PARAM NAME="ARCHIVE" VALUE = "/TheClass.class"> <!-- or "TheJar.jar" -->
to
<PARAM NAME="ARCHIVE" VALUE = "/TheClass.class?v=200406181300"> <!-- or
"TheJar.jar?v=..." -->

The only way to see if this works is to perform your steps above, change
the class file, change the [v]ersion and see what you get when you reload.
 
A

Andrew Thompson

On Sat, 19 Jun 2004 04:39:38 +0800, M wrote:

Please do not top-post M, as I find
it rather confusing..
Actually, I'm using: WinXP, IE 6, JVM 1.4.2.04

Aha!

Tools menu - Alt T
Sun Java Console
'x'

F5 - to reload the page and *classes*
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top