当前位置: 动力学知识库 > 问答 > 编程问答 >

java - how to provide access permission for applet to write on file system

问题描述:

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

网友答案:

Please Go to The below link for Signing applet

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

网友答案:

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.

分享给朋友:
您可能感兴趣的文章:
随机阅读: