RMI is a way for you to call remote method. for example, call a method running on a computer B and receive the resulting response. So computer B is a server providing service.
Create Project RMITutorial
The classes packaged for Client and Server:
This is the working model of RMI. Server will register the object with Registry. Client will then look the Registry up by IP address and Port, so that it can call methods from objects in Server.
To run the RMI application, you need to pack your project into two jar files. The first jar file includes the classes to run in client machine. And second Jar file, including the classes to run in server machine.
This is the illustration:
However, you can run Demo on the Eclipse:
First run the class Server:
Server is running, and it registers Remote Object with the Registry. Next, you run class in Client.