Make a Remote Interface
The remote interface defines the methods that a client can call remotely.It's what that a client will use as a polymorphic class type for your service.Both the Stub and actual service will implement this!
Step two:
Make Remote Implmentation
This is the class that does the REAL WORK. It has It has the real implementation of the remote methods defined in the remote interface.It's the object that the client wants to call methods on.
Step three:
Generate the Stub and Skeletons using rmic
These are the client and server 'helpers'. You don't have to creates those classes or ever look at the source code that generates them.It's all handled automatically when you run the rmic tool that ships with your JAVA DEVELOPMENT KIT.
Step four:
Start the RMI registry(rmiregistry)
The rmiregistry is like the white pages of a phone book.It's where the user goes to get the proxy (the client stub/helper object).
Step five:
Start the remote service
You have to get the service object up and running.Your service implementation class instantiates an instance of the service and registers it with the RMI registry.Registring it makes the service available for clients.
CODING PART
Step one: Make a Remote Interface
Remote is a 'marker' interface, which means it has no methods.It has special meaning for RMI, though, so you must follow this rule.Notice that I say 'extends' here. One interface is allowed to extend another.
public interface MyRemote extends Remote {