<html> <title> Java Security Example: Writing Files</title> <h1> Java Security Example: Writing Files </h1> <hr> Here's an applet that tries to write to the file <code>/tmp/foo</code> on a Solaris system (or to the file <code>C:\tmpfoo</code> on a Windows 95 or Windows NT system.) <p> <!--"CONVERTED_APPLET"--> <!-- CONVERTER VERSION 1.0 --> <OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH = 500 HEIGHT = 50 codebase="http://java.sun.com/products/plugin/1.2/jinstall-12-win32.cab#Version=1,2,0,0"> <PARAM NAME = CODE VALUE = writeFile.class > <PARAM NAME = ARCHIVE VALUE = "signedWriteFile.jar" > <PARAM NAME="type" VALUE="application/x-java-applet;version=1.2"> <COMMENT> <EMBED type="application/x-java-applet;version=1.2" java_CODE = writeFile.class java_ARCHIVE = "signedWriteFile.jar" WIDTH = 500 HEIGHT = 50 pluginspage="http://java.sun.com/products/plugin/1.2/plugin-install.html"><NOEMBED></COMMENT> </NOEMBED></EMBED> </OBJECT> <!-- <APPLET CODE = writeFile.class ARCHIVE = "signedWriteFile.jar" WIDTH = 500 HEIGHT = 50 > </APPLET> --> <!--"END_CONVERTED_APPLET"--> <p> and here's the <a href=writeFile.java>source</a>. <p> This applet is signed by Duke - if you've configured your system to allow applets signed by Duke to run, go and check your /tmp area! (Or your c: drive, if you're running on a PC.) You'll find a file named "/tmp/foo" (or, on a PC, "tmpfoo"), with an important message from Duke :-) </center> <hr> Back to the <a href=../index.html>Java Security Page</a>