In addition to implementing the interface, we also need to write the server's main program. RMI currently does not support server programs as applets, so the main program needs to be a standalone Java application. You can either code a separate Java class for main, or you can just code a main method in the implementation class as we did here.
Note also that we coded the main function to throw any RMI-related exceptions to the command line. That's OK for a small sample program like this, but in a real program you will probably instead bracket the steps that follow in separate try-catch blocks so you can perform better error handling.
The steps that the server main typically does are:
1. Install a security manager class that lets the server program accept stub classes from other machines
2. Create an instance of the server object
3. Register the server object into the RMI naming registry so that client programs can find it
Let's now take a closer look at each of these steps.