views:

486

answers:

4

Hi all,

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.

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)

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.

Appreciate any tips, thanks.

A: 

Place the policy file where the JRE is.

For instance, my policy file is located at C:\Program Files\Java\jre1.6.0_01\lib\security

colinjameswebb
A: 

by default I think it looks for a file named .java.policy in your home directory

you can check the file /lib/security/java.security to see where it looks. check the keys named policy.url.n

objects
Renaming my own created policy file to .java.policy after checking /lib/security/java.security in order to find out where java looks for the policy file, it worked. Thanks every1 for the tips.
makdere
if your problem is solved then please click the tick next to the comment (on the left) that helped you.
objects
thanks mate, glad it helped you
objects
A: 

Check this

The user policy file is named .java.policy by default in your home directory.

But you can also digitally sign your applet, which will give it the required permissions.

Bozho
A: 

I strongly suggest respecting the same-origin policy. Security implications are not necessarily obvious at the best of times. Also, an applet with standard permissions has better usability and should be easier to maintain.

Tom Hawtin - tackline