title: Java RMI Client Server java.security.AccessControlException: access denied ("java.util.PropertyPermission" "java.security.policy" "write")
body: <p>I am working on making a simple RMI server in java. I want to be over a network so i cant use local host for the IP address. I have a lot of code written but I keep getting an error message that reads:</p>
  
  <pre><code>  java.security.AccessControlException: access denied("java.util.PropertyPermission" "java.security.policy" "write")
      at java.security.AccessControlContext.checkPermission(Unknown Source)
          at java.security.AccessController.checkPermission(Unknown Source)
          at java.lang.SecurityManager.checkPermission(Unknown Source)
          at java.lang.System.setProperty(Unknown Source)
  at test_Client.TestClient.main(TestClient.java:31)
  </code></pre>
  
  <p>I have done a lot of looking and cant seem to find out what is wrong with my code.my server starts up fine and is running on my assigned ip and port number. If someone could help me find out why I am getting this error that would be great. Thanks. 
  Here is the sample code for my client </p>
  
  <pre><code>package test_Client;
  //this is the client, it has it's own package 
  
  import java.rmi.NotBoundException;
  import java.rmi.Remote;
  import java.rmi.RemoteException;
  import java.rmi.registry.LocateRegistry;
  import java.rmi.registry.Registry;
  import java.util.Scanner;
  //import all needed rmi files
  
  
  import test_Interface.Constant;
  import test_Interface.testRMIInterface;
  //import my constant file so port number can be found.
  //import my test interface from my example interface project, example server testing
  
  public class TestClient {
  //start my class
  
  
      public static void main(String[] args) throws RemoteException, NotBoundException{
          //throws exceptions so everything is not in try catch blocks...
  
           if (System.getSecurityManager() == null) {
                  System.setSecurityManager(new SecurityManager());
              }
  
  
  
           System.setProperty("java.security.policy", "C:/Users/Robert/workspace/ExampleClient");
  
  
  
           Registry registryClient = LocateRegistry.getRegistry(Constant.SERVER_IP, Constant.PORT_NUM);
          //make my registry client and use port number from constants in example interface
          //get the registry on the servers ip address with the port. 
  
           testRMIInterface remote =  (testRMIInterface) registryClient.lookup(Constant.RMI_ID);
          //using testInterface interface under my example interface
         //look up the RMI ID and link it to the object created above 
  
  
  
  
           //this is the one method i have on the server.
  
           String sendThis = "";
           System.out.println("Please enter a word");
           Scanner keyboard = new Scanner(System.in);
           sendThis = keyboard.next();
           System.out.println(remote.returnTest(sendThis));
          //simple call to the server method returnTest 
          //takes in a string. and returns a different one 
      }
  }
  </code></pre>