how to provide access permission for applet to wri

2019-06-25 13:45发布

问题:

I have problem in setup of policy file for applet.I am doing this first time and don't know how to set the policy file for applet in java.Actually I want to give the permission to the applet to write on the file system. for Which I will have to give file permission to the applet

So I make a file named .java.policy and and put the following code in it

grant codeBase "file:/C://res/applet/*" {
permission java.io.FilePermission "C:\\res\\applet\\test.txt", "read, write";
};

and save this in users\jindal folder now i set the JAVA_HOME as c:\users\jindal

but still I found the exception that

java.security.AccessControlException: access denied (java.io.FilePermission C:\res\applet\test.txt write)

can any body please help what is wrong or what should i do

回答1:

Please Go to The below link for Signing applet

http://java.sun.com/developer/onlineTraining/Programming/JDCBook/signed.html



回答2:

What URL do you put in your browser? And what is codebase on your applet tag? Maybe try first playing with codebase. First I would remove it from policy file to identify whether the problem is in code base or not.