Java Runtime Problems

Last updated: 08.05.2002


Security Exceptions

Certain applets, such as Groan, need to read additional data files from their host. For this to work, your browser's Java:Network Access preference (or equivalent) must be set to allow Applet Host Access. In other words, applets must be allowed to fetch files from the host from which they were downloaded. If your browser is set to deny all network access, the applet will fail with a SecurityException.

If you're behind a firewall, applets will fail even if you've allowed Applet Host Access. This is because the firewall prevents the browser from identifying the host that the applet came from. Setting your browser to allow Unrestricted Access (i.e. the applet can talk to any host on the network) would resolve the problem but is not generally a good idea because it could undermine your firewall (a hostile applet could read information from hosts on your secure network and then retransmit it to an external host).

NetScape Navigator does not allow you to change the level of network access allowed. It defaults to Applet Host Access, which will generally be sufficient except when run from behind a firewall.

Most Web browsers will also report security exceptions when running an applet in local mode (i.e. from a hard disk, rather than over a network) if the applet tries to load an additional file. For good reasons, Java regards any attempt to read files from a local disk as suspicious. Standalone applet viewers may waive this restriction and allow you to test applets locally. Some newer browsers may also permit access to files provided those files are stored in the same location (i.e. the same directory) as the classfiles for the applet.

Array index out of bounds

The exception ArrayIndexOutOfBoundsException generally means what it says - that you've tried to read or write to an element of an array which is outside the defined size of the array (easy to do if your loop doesn't terminate or you get your sums wrong). However, there's one circumstance in which this error may be misleading.

If an applet fails to load, and you see this exception in Navigator's status bar when you move the mouse over the space where the applet should be, take a look at the Java console. You may well discover that the real error is that Navigator can't find the Java Archive (JAR) file that defines the applet. In this case, check to ensure that everything's where it should be, and try again.


[raingod:resources:java] -- [up][links][home]