Results 1 to 7 of 7
Thread: Applet: Can't write a file
- 09-03-2009, 11:39 AM #1
Member
- Join Date
- Sep 2009
- Location
- Amsterdam, The Netherlands
- Posts
- 3
- Rep Power
- 0
Applet: Can't write a file
Dear Members,
I have made an FreeCell-game-applet that works, but I want it to write text files so that it can *learn* from human mistakes. Sorry administration does not allow me to post the link.
Now when I compile and run my applet in eclipse, it works fine, but as soon as I put it in a separate directory, either on a server or local, and run it WITHOUT eclipse, I get this error:
Exception in thread "AWT-EventQueue-3" java.security.AccessControlException: access denied (java.io.FilePermission 1251970144054_sequence.txt write)
Any help would be appreciated.
Sincerely,
Daan van den Berg
Amsterdam
- 09-03-2009, 12:05 PM #2
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Did you check that what's the error AccessControlException in Java doc? If you can read it, you can have a better idea what you've done in wrong way.
- 09-03-2009, 12:12 PM #3
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
Applets are naughty little things that are presumed guilty until proven innocent.
You need to sign your applet to prove that it is indeed innocent and allow it to access delicate things like the file system or databases.
Why does it need to be an applet and not a normal Java application? Why not serve the application using webstart if you want it to be available over the web?Last edited by r035198x; 09-03-2009 at 12:15 PM.
- 09-03-2009, 12:57 PM #4
Member
- Join Date
- Sep 2009
- Location
- Amsterdam, The Netherlands
- Posts
- 3
- Rep Power
- 0
@both
Thanks for your replies.
@ Eranga
Done that. I'm sure it has something to do with this: "...or request access that is not allowed according to the security policy...". But I'm alsoconvinced it's in the JAVA-code.
@r035198x
I think signing is only necessary if you open my webpage and the including applet and want to allow it to write to YOUR directory. You then have to "accept the certificate". In this case I want it to write simply into the directory it is started from in the first place.
DaanLast edited by DaanDwars; 09-03-2009 at 12:58 PM. Reason: [correction]
- 09-03-2009, 01:01 PM #5
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
- 09-03-2009, 01:12 PM #6
Member
- Join Date
- Sep 2009
- Location
- Amsterdam, The Netherlands
- Posts
- 3
- Rep Power
- 0
Hmmm ... you're right.
But loading files works, but that might have to do with the call GetDocumentBase().
Would you say it makes more sense to ask: "how can I write a text file to a specific location on the web?" by the latter meaning my own directory on the server?
Daan
- 09-03-2009, 01:26 PM #7
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
Similar Threads
-
Signed Applet to write on LPT1 port - permission error
By ConvoyTh in forum Java AppletsReplies: 0Last Post: 07-02-2009, 10:56 AM -
Write to a file in a jar
By Ms.Ranjan in forum New To JavaReplies: 4Last Post: 06-12-2009, 09:27 PM -
How to read and write to a file without taking out the comments in the file
By MAGNUM in forum New To JavaReplies: 5Last Post: 02-05-2009, 10:28 AM -
[SOLVED] File Write in File
By Eku in forum New To JavaReplies: 4Last Post: 10-27-2008, 04:01 AM -
Write to file
By esadeghi in forum Advanced JavaReplies: 1Last Post: 05-21-2008, 01:13 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks