Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Access Denied Error When Writing to a File

1 view
Skip to first unread message

Ken Robbins

unread,
Sep 11, 1999, 3:00:00 AM9/11/99
to
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.

--
Ken Robbins
Remove NOSPAMTHANKS to reply by e-mail.

Roedy Green

unread,
Sep 12, 1999, 3:00:00 AM9/12/99
to
On Sat, 11 Sep 1999 20:33:33 -0500, Ken Robbins
<puyrebelNO...@prodigy.net> wrote or quoted :

>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-

Ken Robbins

unread,
Sep 12, 1999, 3:00:00 AM9/12/99
to
Roedy Green wrote:
>
> On Sat, 11 Sep 1999 20:33:33 -0500, Ken Robbins
> <puyrebelNO...@prodigy.net> wrote or quoted :
>
> >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

So, I have to get a certificate in order to run it?

Roedy Green

unread,
Sep 12, 1999, 3:00:00 AM9/12/99
to
On Sun, 12 Sep 1999 13:06:39 -0500, Ken Robbins
<puyrebelNO...@prodigy.net> wrote or quoted :

>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

Charles P. Copeland

unread,
Sep 15, 1999, 3:00:00 AM9/15/99
to
Ken,

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.
>

0 new messages