Here is the code I use to rebind:
The InvokerServer class extends UnicastRemoteObject.
try{
String name = "Invoke";
IInvoke invokee = new InvokerServer();
Naming.rebind(name, invokee);
System.out.println("Invoker is Listening");
}catch (Exception e){
throw new RuntimeException(e.getMessage());
}
Here is the code I use for lookup
IInvoke invoker = (IInvoke) Naming.lookup("//" + 128.238.44.237 + "/Invoke");
128.238.44.237 is the IP address of the machine I am trying to connect to (the one that has the server bound to rmiregistry using the code above)