Notes

This example assumes a rudimentary knowledge of the Java approach to RMI (remote method invocation).  Students without any knowledge of RMI may prefer to study the proposed solution and perhaps extend it with a new operation, e.g., subtraction or multiplication. The steps required for executing the remote calculator are contained in the Perl script cmd.pl in this directory. The security setting for executing the remote calculator are defined in file java.policy in this directory.

The proposed interface CalculatorIF implements/extends Remote, an empty interface or marker, defined in the java.rmi package.  Why is this  marker needed?  If CalculatorIF does not implement/extend Remote, then, when the "rmic" utility is executed on Calculator, the class that implements interface CalculatorIF, the following error is reported:

error: Stubs are only needed for classes that directly implement an interface that extends java.rmi.Remote; class Calculator does not directly implement a remote interface.

Trace

Trace of execution of the script cmd.pl on a linux laptop on 04/07/2020.
    antoy@greystar:$ ./cmd.pl 
    Compiling on host greystar 
    Removing old class files 
    Compiling all java files 
    Note: Some input files use or override a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    Running rmic to create Stub and Skel 
    Warning: generation and use of skeletons and static stubs for JRMP	
    is deprecated. Skeletons are unnecessary, and static stubs have	
    been superseded by dynamically generated stubs. Users are	
    encouraged to migrate away from using rmic to generate skeletons and static	
    stubs. See the documentation for java.rmi.server.UnicastRemoteObject.
    Make sure there is a route to remote host 
       *** script does not check *** 
    Running the registry 
    Starting remote program 
    Sleeping 10 secs. (you should see "Server: Calculator bound") 
    Server: Calculator bound
    Starting client 
    Client: Calculator result: 7.7
    Remember to kill remote program and registry 
    antoy@greystar:$