Security Restrictions for Applets 


Since applets can be embedded in any web page, they could execute on your computer any time you surf the web. Therefore, some security restrictions are placed on applets by the web browser, to stop the applet from doing any harm to your computer. Some of these restrictions are as follows:
an applet can not close down the web browser it is executing in, hence it can not execute the 'System.exit' method
an applet is prevented to write anything to the local disk of the computer it is executing on
an applet can only read documents located in 'web space'
an applet can only read from the machine where the applet came from
an applet can only connect to servers on the machine where the applet came from
Note that these restrictions do not prevent an applet to instruct the browser to load any web page, but it does restrict the applet from loading an image unless the image is located on the same machine as the applet (but in possibly different directories). Actually, that is not so bad, because if your applet relies on an image located elsewhere, your program may not run any longer if the image is removed.

Standalone programs do not have these security restriction. Therefore, if you need to create a program that saves data to a file, you have two alternatives:
write an applet plus a standalone server. The applet can talk to the server (provided they are located on the same machine) and the server in turn (being a standalone program) can save the data to file. We will explore these details later
write a standalone program in Java. Such programs can read and write to the local disk just as any other programs can

(bgw)