i have written the code in client,server,interfaces.i have created stubs and skaleton.
i have run rmiregistry very well.i have run server.i have an error in client side,when i run client.it is moving to the catch not looking up to the correct address of server.
the code of client is:
import java.rmi.*;
import java.rmi.server.*;
import java.applet.Applet;
import java.awt.Graphics;
import java.rmi.Naming;
import java.rmi.RemoteException;
public class RMIClient
{
public static void main(String argv[])
{ System.setSecurityManager(new RMISecurityManager());
RMIExample RemRMIExample = null;
try
{
RemRMIExample = (RMIExample)Naming.lookup("rmi://localhost/hi");
System.out.println(RemRMIExample.hello());
}
catch (Exception e)
{
System.out.println("Client: Exception thrown looking up ");
System.exit(1);
}
try
{
RemRMIExample.hello();
}
catch (Exception e)
{System.out.println("Client: Exception thrown calling PostMsg().");
System.exit(1);
}
}
}
my questio in 2 parts:
1. in case where client and server on same machine what must i type,is this correct:
RemRMIExample = (RMIExample)Naming.lookup("rmi://localhost/hi");
bcs it is not looking for correct server.and client is not running correctly.
2.in remote case what must i type.
thanxs,i appreciate any help