May 1, 1996 1:00 AM PT

Java Tip 7: Reloading applets in Netscape Navigator

Five ways to force Netscape Navigator to reload your Java applet

This week we explore various methods to coerce Netscape's Navigator to reload Java applets without having to exit and restart the browser.

Netscape caches Web pages and Web page content, including Java applets, to increase performance. This feature seems to be a nuisance to people using Netscape Navigator to test their applets: Once loaded, the applet stays loaded; merely reloading the HTML page does not reload the applet.

Since the caching system is the problem, some people disable caching while testing applets. This can be done by changing the Disk Cache size to 0 in the Options menu, Network Preferences... popup, Cache folder.

If you're like me you will forget to turn caching back on when you are done testing, and browsing will be slow and irritating. You can instruct Netscape to clear its disk cache on a one-shot basis via the Clear Disk Cache Now button on the same screen. That is not always effective by itself. If that doesn't work, try hitting the Clear Memory Cache Now button and see if that jars it back to life.

Another one-shot method is to disable and then re-enable Java support from the Options menu, Security Preferences... window, General folder. First, you have to toggle the Disable Java button to on and then click on the Ok button. Bring up the preferences window again and toggle the Disable Java button to off and click on the Ok button. Now, hit the reload button and the Web page and the applets will be reloaded.

The most complicated method to set up but easiest to use is this: Put your applet inside a simple HTML file and load that file via an HTML Frame in another file. You have to leave the main page and then link to it: you cannot just click on the reload button. A wonderful example of all of this insanity is illustrated by Tip 3.

Ouch. All of those methods make me tired just thinking about all that work for such a simple task. Luckily there is one more way of forcing Netscape to reload everything. Hold down the SHIFT key and then press the reload button. How's that for simple!?

Given the SHIFT-reload trick, why did I bother discussing all of those other methods? The main reason is that it does not seem to work on all versions of Netscape on all platforms with Java support. If it doesn't work for you, try the security preferences method as that is a relatively small hassle and and does not cause too much pain.

John D. Mitchell is yet another UC-Berkeley Computer Science graduate weaned on caffeine, sugar, and way too little sleep. He spent three years toiling on PDA software at Geoworks for stock that is actually worth more than wallpaper. He bailed out of his day job after the first public release of Java to develop applets and a Java compiler. He funds his Java addiction by writing compilers, Tcl/Tk, Perl, C++, and Java systems. His copious spare time is consumed by moderating the comp.lang.tcl.announce newsgroup and writing an awesome Java book.