AccessControlException: What am I doing wrong?

Hey guys. I am trying to read an write fileson the web server that the applet is on but I keep getting an AccessControlException error. Here is the method that is getting the error:

publicvoid saveFile()

{

File dayFile =new File( fileName );

try

{

BufferedWriter out =new BufferedWriter(new FileWriter(dayFile));

for(int i = 1; i <=9 ; i++)

{

out.write(prayerSection[i].textarea.getText());

}

out.close();

JOptionPane.showMessageDialog(null,"File " + fileName +" has been saved.","Alert", JOptionPane.ERROR_MESSAGE);

}

catch (IOException e)

{

JOptionPane.showMessageDialog(null,"An error has occured while trying to write the file","Alert", JOptionPane.ERROR_MESSAGE);

}

}

Nothing too exciting but I just can't seem to get it to work. Thanks guys.

-Bradly

[1539 byte] By [bradlyfa] at [2007-10-1 10:17:49]
# 1

Normally "writing files on the web server" means you post the file using the http protocol

and let server side script do the File IO or database access to save the file.

http://javaalmanac.com/cgi-bin/search/find.pl?words=post

When posting binary filesor multiple files it would be more difficult both client and server

side since you have to post it multipart.

http://jakarta.apache.org/commons/fileupload/

http://forum.java.sun.com/thread.jspa?threadID=579720&tstart=135

(second post)

The code you provided suggest that fileName is a UNC path to the server, if the applet is

signed and trusted by the user or a policy has been set up for the applet and the user

has write permission on the server it should work.

harmmeijera at 2007-7-10 2:44:49 > top of Java-index,Security,Signed Applets...