Messing with applets

Separate from working with jME, I have also been doing other stuff in java. One of those things is that I have been trying to do applets. I am not sure what the problem is, but when I first write my applet, I save and compile it and then stick in the applet html tag to make it appear. I then load the html page and the applet appears and works like I expect it to. Then I wanted to make a change to the applet, (for instance I added another button to the applet for more functionality).  I again save and recompile the class, but when I reload the page, the applet stays the same. I am not sure how to fix this. Any ideas?

Sounds like your web browser is caching your applet. Clear your cache and then reload the page.

Ha I bet that is it, I figured it had to do with the web browser not "destroying" the applet, I will try that! THANKS!

Hmm… I spoke too soon. It still doesn't seem to be working. I clear the cache, but then when I reload the page, it doesn't ask if I want to use java or anything like that.

try renaming the applet to something else. Then if that works, you know it is being cached.

Do you mean renaming the class in netbeans or just changing what is in the applet tag in my html file?


Okay, so I renamed the class and compiled it and then I changed the file name in the applet tag and this time it correctly displayed the applet. So that means it is being saved in the cache?

Yes it does. Your browser "not destroying" the applet means that in addition to clearing the cache, you'll also have to unload the applet from memory - I don't know of any other way to do this than restarting the browser.

Is this a problem that a lot of people experience when working with applets? Should I try using a different browser? Is it VISTA's fault?

Treebranch said:

Is this a problem that a lot of people experience when working with applets? Should I try using a different browser? Is it VISTA's fault?

No, this is expected behavior and it was designed this way. This is so you don't have to download all of the web page content every time you visit. Saves time, and money (bandwidth). It may be a pain for you while developing your applet, but once its done and you put it up for real, its not going to be changing so it isn't an issue. This is just something to be aware of when doing any web related development.

with lwjgl's applet loader, you can control the caching i think:

try to change the al_version tag or don't specify it at all.

Has any one heard of the appletViewer? I have seen it mentioned in books, but they really don't give any explanation on how to use it or where it is accessed from… I would appreciate some help on that!

Tutorials I have read on using the appletViewer show using a line similar to this:

appletviewer example1.html

I am just not really sure where to run that line of code... Is it done in some sort of putty or commandPrompt window or somewhere else? Has anyone used the appletViewer before?

You will find it in your jdk bin folder: jdk1.5.0_06bin

It is a command line tool, so if you are using Windows XP go Start->Run and type 'CMD' and hit enter.

Open My Computer and and navigate to the java folder in C:Program filesJavajdk1.5.0_06bin and find the appletview program.

Change directories in your CMD window to that of the appletviewer. Then you can just type appletviewer <path_to_html_file> and hit enter.

I've never used it though, so after that your are on your own.