Java 安全策略文件问题
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6020560/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Java security policy file question
提问by Mike
Okay guys, I am trying to get the interpreter to use my .policy file for some JAAS stuff I am doing. When I try to enter the extra entry (ie. policy.url.3=file:/C:/Test/raypolicy )in my Windows:java.home\lib\security\java.securityfile, it refuses to save the new entry. I get a Save not successufulprompt telling me to make sure that the program is not open in somewhere else. Of course, it is not open somewhere else.
好的,我正在尝试让解释器将我的 .policy 文件用于我正在做的一些 JAAS 事情。当我尝试 在我的Windows:java.home\lib\security\java.security文件中输入额外的条目(即 policy.url.3=file:/C:/Test/raypolicy )时,它拒绝保存新的入口。我收到一个Save not successuful提示,告诉我确保该程序没有在其他地方打开。当然,它在其他地方是不开放的。
I know that it is a wrong setting somewhere on my computer as I am able to save to my java security file on my computer at work. I am running a Windows 7 on my personal computer and a windows xp at work. I have also already checked the file settings for the security file and I am set up as the administrator so I have authority to change the file, etc. Any and all thoughts are welcome.
我知道这是我计算机上某处的错误设置,因为我可以在工作时将其保存到我计算机上的 Java 安全文件中。我在我的个人计算机上运行 Windows 7,在工作时运行 Windows xp。我也已经检查了安全文件的文件设置,我被设置为管理员,所以我有权更改文件等。欢迎任何和所有想法。
回答by Liv
Make sure you run the editor you use to edit the file (e.g. notepad) as Administrator -- otherwise the file permissions set on that directory will not allow you to modify the file. Right click on notepad, select "Run as administrator" then load the file in notepad, edit it and save it and that should work.
确保以管理员身份运行用于编辑文件的编辑器(例如记事本)——否则在该目录上设置的文件权限将不允许您修改文件。右键单击记事本,选择“以管理员身份运行”,然后在记事本中加载文件,编辑并保存它,这应该可以工作。
回答by Shrikant Havale
One more option that worked for me was,
对我有用的另一种选择是,
- Copied the original file
java.security
to my desktop. - Changed the desktop version using notepad++ or any editor
- Saved it.
- And copied back this updated version to original file replacing the entire file.
- Opened the file to confirm the changes
- Deleted the desktop version.
- 将原始文件复制
java.security
到我的桌面。 - 使用记事本++或任何编辑器更改桌面版本
- 保存了它。
- 并将此更新版本复制回原始文件以替换整个文件。
- 打开文件以确认更改
- 删除了桌面版。