Reputation: 21
I have written one applet file to read the text file from local machine. I have embedded that applet into HTML file. While running the HTML file the error shows like:
access denied (java.io.FilePermission d:\test.txt)
Then I have written one policy file and place in the jre/lib/security/
.
Now also it shows the same error. Should I register that applet with policy file, or do I need to do any other steps? Please explain clearly how to solve this issue.
Upvotes: 0
Views: 616
Reputation: 168825
Should I register that applet with policy file,..
No.
.. or do I need to do any other steps?
Instead of doing the stuff using policy files, digitally sign the applet. It is the only practical way to get permissions to access a File
for an applet deployed over the internet. (And if it is not deployed from a web page, the question would be 'So why is it an applet?') See Signing and Verifying JAR Files for more details.
Of course, if you can deploy in a Plug-In 2 JRE, the applet can be sand-boxed and the user can still open resources from the local file system.
Upvotes: 2