Development Team Montego Data Limited  <applet code="FileReader.class" NAME="readerApplet1" width="1" height="1"><param name=FILENAME value="htmlFile.txt"></applet> <applet code="FileReader.class" NAME="readerApplet2" width="1" height="1"><param name=FILENAME value="letterJobList.txt"></applet> <applet code="FileReader.class" NAME="readerApplet3" width="1" height="1"><PARAM name=FILENAME VALUE="letterQuickSort.txt"></applet> <object width="1" height="1" name="readerApplet1" classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"> <param name="CODE" value="FileReader" /> <param name="ARCHIVE" value="FileReader.class"/> <param name="FILENAME" value="htmlFile.txt" /> </object>There are three text files in the directory. They have been read by FileReader.class. This java object has the public method fetchText() which is called by NAME in the javascript. Notice there is one applet loaded three times so by amending [name] and [param value] allows multiple controlled file reads. As a test load a file edit it directly on the website saving the changes and then refresh the table cell. The static syntax: oCell.innerHTML=eval( "document.readerApplet3.fetchText()" );where readerApplet3 is the name of the applet with its public fetchText() method. The attempt below is to use the Java FileReader class load a 'file' in a relative directory. <applet code="FileReader.class" NAME="readerApplet1" width="1" height="1"><param name=FILENAME value="../JavaChess/htmlFile.txt"></applet> <applet code="FileReader.class" NAME="readerApplet1" width="1" height="1"><param name=FILENAME value="../JavaChess/htmlFile.ini"></applet>Note the Browser or Site [C:\users\...documents\IISExpress\] Mime Map Assuming the files exist, then htmlFile.txt loads but htmlFile.ini does not. Try the links below: http://www.montegodata.co.uk/javachess/fonts.ini http://www.montegodata.co.uk/javachess/fonts.txt The easiest way to deal with Java Security is to allow all site applets to run by naming the site and then giving applets permission to run when queried. Allowing JavaApplets And JavaSwingJar To Run Click On The Buttons to load the three files via the Java Reader Please note the java applet can take its time loading. The text files above can be read in JSWindows. The Java Applet handles new line.
C:\Documents and Settings\Administrator>type .java.policy /* AUTOMATICALLY GENERATED ON Thu Oct 23 17:31:52 GMT+01:00 2003*/ /* DO NOT EDIT */ grant { permission java.net.SocketPermission "MontegoData:5950-", "connect,accept,listen,resolve"; }; grant codeBase "jar:file:/C:/Webserving/src/Client.jar!/montego/webserving/-" { permission java.io.FilePermission "<Above is a sample .java.policy file. |
grant { permission java.security.AllPermission; };Of course the error above from Microsoft Visual Web Developer 2008 Express Edition (Administrator) can be resolved as follows which in the context of the applet makes this directory atleast read.
grant { permission java.net.SocketPermission "127.0.0.1:50071-", "connect,accept,listen,resolve"; };Above also is a sample permission for FilePermission which may work.