I've been trying to run an RMI example but have been getting the above error on both linux and windows. I have seen people with same problem online but in different situations.
My server class is:
import java.rmi.*;
import java.rmi.server.*;
public class CityServerImpl extends UnicastRemoteObject implements CityServer {
    CityServerImpl() throws RemoteException {
        super();
    }
    public String getCapital(String country) throws RemoteException {
        System.out.println("Sending return string now - country requested: " + country);
        if (country.toLowerCase().compareTo("usa") == 0)
            return "Washington";
        else if(country.toLowerCase().compareTo("ireland") == 0)
            return "Dublin";
        else if (country.toLowerCase().compareTo("france") == 0)
            return "Paris";
        return "Don't know that one!";
    }
    public static void main(String args[]) {
        try {
            System.setSecurityManager(new RMISecurityManager());
            System.out.println("Security manager set");
            CityServerImpl cityServer = new CityServerImpl();
            System.out.println("Instance of City Server created");
            Naming.rebind("Capitals", cityServer);
            System.out.println("Name rebind completed");
            System.out.println("Server ready for requests!");
        } catch(Exception exc) {
            System.out.println("Error in main - " + exc.toString());
        }
    }
}
I put the interface, CityServer class and my client class into a folder and put the following into the terminal.
javac -cp . *.java
rmic CityServerImpl
rmiregistry &
java CityServerImpl
And I get back:
Security manager set
Instance of City Server created
Error in main - java.security.AccessControlException: access denied ("java.net.SocketPermission" "127.0.0.1:1099" "connect,resolve")
The 'Naming.rebind("Capitals", cityServer);' appears to be the problem. I have found mentions of a policy file but I have been told that this should run fine without one. Both the client and server would be running on the same PC. Any idea on how to get around this?