Section 13.4. Creating the Stubs and Skeletons


13.4. 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.



Java Enterprise in a Nutshell
Java Enterprise in a Nutshell (In a Nutshell (OReilly))
ISBN: 0596101422
EAN: 2147483647
Year: 2004
Pages: 269

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net