The code below will give you the basis to Java RMI with a very simple example of a Server-Client communication model. The is given the 6 steps to write the RMI program.
#Create the remote interface #Provide the implementation of the remote interface #Compile the implementation class and create the stub and skeleton objects using the rmic tool #Start the registry service by rmiregistry tool #Create and start the remote application #Create and start the client application