A Simple Java RMI Example

Download the following code into directory C:\RMI:

Compile the example as follows:

C:\RMI> javac -classpath ./ RMIServer.java
C:\RMI> rmic -classpath ./ RMIServer
C:\RMI> javac -classpath ./ RMIClient.java

Execution the RMI example as follows:

C:\RMI> java -classpath ./ RMIServer
C:\RMI> java -classpath ./ RMIClient <server’s address> 8686 <message text>

Note that the RMIServer and RMIClient can be run on different machines.