如何为小程序提供在文件系统上写入的访问权限 [英] how to provide access permission for applet to write on file system
问题描述
我在为小程序设置策略文件时遇到问题.我是第一次这样做,不知道如何在 java 中为小程序设置策略文件.实际上我想授予小程序在文件系统.为此,我必须向小程序授予文件权限
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
所以我创建了一个名为 .java.policy 的文件并将以下代码放入其中
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";
};
并将其保存在 users\jindal 文件夹中,现在我将 JAVA_HOME 设置为c:\用户\金达尔
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:访问被拒绝 (java.io.FilePermissionC:\res\applet\test.txt 写入)
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/编程/JDCBook/signed.html
这篇关于如何为小程序提供在文件系统上写入的访问权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!