There is a tricky in getting Java RMI works and runs. First, you need to understand the Overview of Java RMI and know how to implement it. Java RMI relies on 3 components–client, server and registry service.
Note: This article refers to the code developed in How to Implement Java RMI.
There are 2 ways to deal with registry service.
rmiregistrycommand in Dos prompt or Console if it is not created in the code
- Create RMI registry service in the code
Registry registry = LocateRegistry.createRegistry(1099);
- It needs interface class(
IPower.java) created in Step 1 of How to Implement Java RMI article
- It also needs interface class (
- Be sure that you pointed to the right server’s registry service