O'Reilly logo

Java Enterprise in a Nutshell, Third Edition by William Crawford, Jim Farley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating the Stubs and Skeletons

As mentioned earlier, JVMs in the 1.4 or earlier versions of Java require that you generate stub/skeleton classes using the RMI compiler. Once the interface and implementation classes have been compiled using the standard Java compiler, the RMI compiler (rmic, in the Sun JDK) is used to generate the stub and skeleton classes depicted earlier in Figure 13-1. In its simplest form, you can run rmic with the fully qualified class name of your implementation class as the only argument. For example, once we’ve compiled the Account and AccountImpl classes, we can generate the stubs and skeletons for the remote Account object with the following command (Unix version):

        % rmic AccountImpl

If the RMI compiler is successful, this command generates the stub and skeleton classes, AccountImpl_Stub and AccountImpl_Skel, in the current directory. The rmic compiler has additional arguments that let you specify where the generated classes should be stored, whether to print warnings, and so on. For example, if you want the stub and skeleton classes to reside in the directory /usr/local/classes, you can run the command using the -d option:

        % rmic -d /usr/local/classes AccountImpl

This command generates the stub and skeleton classes in the specified directory. A full description of the rmic utility and its options is given in Appendix F.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required