java小程序策略文件放在哪里? [英] Where to place java applet policy file?
问题描述
我正在做一个人工智能项目,这是一个逻辑游戏,目标是两个用户连接到网络上的服务器,充当管理员,然后开始一个一个地玩.
I am working on an artificial intelligence project which is a logic game and aims two user connecting to the server on the network who acts as an Admin and then start to play one by one.
为了创建连接,我有一个服务器代码,它只是监听 localhost:8000 并在客户到达时将团队价值分配给他们.连接后,客户端在管理员的控制下移动.
In order to create connections, i have a server code which is just listening on localhost:8000 and assigning team values to the clients as they arrive. After connecting, clients make their move under Admin's control.
问题是,当我尝试在浏览器中运行我的代码时,它失败并显示以下错误:
The question is that when i try to put my code to work in the browser it fails with the following error:
java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:8000 connect,resolve)
即使我已经创建了自己的策略,首先只授予对我的项目文件夹(file:///home/xxx/projects/-
)的代码库的 Socket 访问权限,之后它没有不行,我从 all 代码库中授予了 all 权限.我尝试将我的策略文件放在主目录和我的小程序代码所在的同一目录中.
Even though i have created my own policy, first granting only Socket access permission to the codebase of my project folder (file:///home/xxx/projects/-
), after it didn't work i granted all permissions from all codebase. I tried placing my policy file both in the home directory and in the same directory where my applet code resides.
感谢任何提示,谢谢.
推荐答案
默认情况下,我认为它会在您的主目录中查找名为 .java.policy 的文件
by default I think it looks for a file named .java.policy in your home directory
您可以检查文件/lib/security/java.security 以查看它的位置.检查名为 policy.url.n
you can check the file /lib/security/java.security to see where it looks. check the keys named policy.url.n
这篇关于java小程序策略文件放在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!