-1

In Java JApplet, file read and write operations did not work in webrowser. When I click "Ok" button, it should be write some file in our local path. But it shows below error. How to resolve this error?

java.security.AccessControlException: access denied (
    "java.io.FilePermission" "D:/.../.html" "write")
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
Rishi
  • 95
  • 2
  • 9
  • 1
    *"When I click "Ok" button, it should be write some file in our local path."* What 'Ok' button? Do you mean you have digitally signed the code, and that when the browser loads the applet, you are prompted to accept/allow the digitally signed code? Pretend we are not psychic or looking over your shoulder at the screen of your PC. – Andrew Thompson Apr 11 '12 at 08:20
  • As an aside, what is the size and nature of the information in this file? Please be as specific as practical (privacy allowing). – Andrew Thompson Apr 11 '12 at 08:23
  • @Andrew Thompson like a shark in the oceanarium :-) I think that you frightened the life out of her/him :-) – mKorbel Apr 11 '12 at 08:28
  • @Rishi please follows suggestion by Andrew Thompson, – mKorbel Apr 11 '12 at 08:30
  • 1
    @mKorbel *"like a shark in the oceanarium"* ;) My methods are strange, but my intent is good. – Andrew Thompson Apr 11 '12 at 08:40
  • 1
    How did you solve the problem? The whole point of this community is to share your findings, not just come here for answers and ditch off. – xil3 Jun 10 '13 at 15:32

1 Answers1

7

By default whenever a applet tries to access local resources, its denied as a part of security layer. You have following options if you need to access using applet:

  1. Sign your applet using any signing mechanism and then publish,
  2. ( though this one is not a useful and recommended way of doing this.)Change the security settings on the computer where the applet is executing.
Akash Yadav
  • 2,411
  • 20
  • 32