When I try to write to a text file (chat.txt) in my applet, I receive
the bottom error message. It can, however, read the file and print it
out fine. Any help would be appreciated.
-- Error Message --
Exception occurred during event dispatching:
java.security.AccessControlException: access denied
(java.io.FilePermission chat.txt write)
at java.security.AccessControlContext.checkPermission(Compiled Code)
at java.security.AccessController.checkPermission(Compiled Code)
at java.lang.SecurityManager.checkPermission(Compiled Code)
at java.lang.SecurityManager.checkWrite(SecurityManager.java:946)
at java.io.FileOutputStream.<init>(FileOutputStream.java:96)
at java.io.FileWriter.<init>(FileWriter.java:39)
at chat.actionPerformed(chat.java:31)
at java.awt.Button.processActionEvent(Button.java:308)
at java.awt.Button.processEvent(Button.java:281)
at java.awt.Component.dispatchEventImpl(Compiled Code)
at java.awt.Component.dispatchEvent(Compiled Code)
at java.awt.EventQueue.dispatchEvent(Compiled Code)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:68)
-- End Error Message --
Thanks.
--
Ken Robbins
Remove NOSPAMTHANKS to reply by e-mail.
>When I try to write to a text file (chat.txt) in my applet, I receive
>the bottom error message. It can, however, read the file and print it
>out fine. Any help would be appreciated.
see "Applet" and "signed Applet" in the Java glossary.
The Java glossary is at http://mindprod.com
--
Roedy Green, Canadian Mind Products
Ready to take on new telecommute programming contracts.
-30-
So, I have to get a certificate in order to run it?
>So, I have to get a certificate in order to run it?
The following is quoted from the Java glossary under "certificate".
I suggest you look up the words "certificate", "signtool", "signed
Applet", "applet", "digital signature", "Netscape" and follow links
for even more entries.
Do you have to buy a digital certificate to let Applets bypass
security? Yes and no. You can create yourself a free phony certificate
with the Netscape jar-signing tool. It lets you run the Applet.
However anyone can make a phony certificate with your name on it. It
is marked as self-issued, rather than vouched for by Verisign or
Thawte. Users out in the world would/should refuse to grant your
Applet special privilege, since there is no guarantee you actually
wrote the Applet and that it has not been tampered with. However, a
phony certificate is useful for debugging while you await your real
certificate to arrive -- which can take months of farting about. You
might also use phony certificates for strictly in-house company use.
The Java glossary is at http://mindprod.com
Applets normally don't have permission to write to a file. You need to
implement the Netscape PrivilegeManager and/or the Microsoft PolicyEngine
classes to get around this. With these classes you can give yourself
permission to write to a file. If you are downloading this applet from a
server, you will have to go an extra step and 'sign' the applet so that a
user can decide if he/she will allow you to write to their filesystem.
Hope this helps,
Charles
Ken Robbins <puyrebelNO...@prodigy.net> wrote in message
news:37DB02EC...@prodigy.net...
> Hello all-
>
> When I try to write to a text file (chat.txt) in my applet, I receive
> the bottom error message. It can, however, read the file and print it
> out fine. Any help would be appreciated.
>
> -- Error Message --
>
> Exception occurred during event dispatching:
> java.security.AccessControlException: access denied
> (java.io.FilePermission chat.txt write)
> at java.security.AccessControlContext.checkPermission(Compiled Code)
> at java.security.AccessController.checkPermission(Compiled Code)
> at java.lang.SecurityManager.checkPermission(Compiled Code)
> at java.lang.SecurityManager.checkWrite(SecurityManager.java:946)
> at java.io.FileOutputStream.<init>(FileOutputStream.java:96)
> at java.io.FileWriter.<init>(FileWriter.java:39)
> at chat.actionPerformed(chat.java:31)
> at java.awt.Button.processActionEvent(Button.java:308)
> at java.awt.Button.processEvent(Button.java:281)
> at java.awt.Component.dispatchEventImpl(Compiled Code)
> at java.awt.Component.dispatchEvent(Compiled Code)
> at java.awt.EventQueue.dispatchEvent(Compiled Code)
> at java.awt.EventDispatchThread.run(EventDispatchThread.java:68)
>
> -- End Error Message --
>
> Thanks.
>