Arith Example Stub and Skeleton

Once you have created the class implementing the server, ArithImpl.class, you can generate the corresponding stub and skeleton with the rmic compiler provided with the JDK.

To make things more concrete, suppose that the package is named mahmoud.ch8 and the directory is

c:\courses\cps530\rmi\mahmoud\ch8
which contains the file ArithImpl.java.

Then you open a DOS window on the rmi directory and type

javac mahmoud\ch8\ArithImpl.java

to compile the code. Next, you use the rmic compiler:

rmic -d . mahmoud.ch8.ArithImpl

N.B. rmic works on .class files, not .java files. So run javac first!

This creates ArithImpl_Stub.class and ArithImpl_Skel.class and puts them in the ch8 directory where the ArithImpl.class file also lives. (That's the point of the -d . )

Often these files are moved elsewhere (for example, the stub file might be moved to a directory accessible to a web server). In this example, they can be left where they are.