Java Security Example: Writing Files


Here's an applet that tries to write to the file named "writetest".

Here's the source.

This applet won't work unless you've configured your policy to allow it to write such a file; if not, you will see an AccessControlException. If you've configured your system to allow applets from this applets' location to write the specified file, check your current directory! You'll find a file there named "writetest".