4.4.1 Constructing the Interface

Create a directory that can be made globally readable and accessible, in which you'll be working.

Java RMI works through the manipulation of interfaces. For this simple application, the interface should be named so that it won't be confused with anyone else. Create a java file userid.java where userid is your login name. In this file we are going to create the interface to the server.

import java.rmi.*;

public interface Ianw extends Remote {

   public static final String rmiName = "Ianw";

   public String sayHello() throws RemoteException;
}

Note that the method throws RemoteException and that the actual interface extends Remote. This is the way that the RMI compiler system knows which code to generate the stub code for.

Ian Wakeman 2005-02-22