Chapter 3 The Classic Hello World Program | ||
Compile Class FilesThe next step is to compile the files just created. I am assuming that all source files are in a directory named HelloWorld. Compile the source files using the command line: c:\HelloWorld> javac *.java or c:\HelloWorld> javac HelloInterface.java HelloServerImpl.java HelloClient.java Create Stub and Skeleton classes using RMICThe rmic compiler is used to create Stub and skeleton classes. The compiler is invoked with the class name of the remote object class not with the remote interface class. The class must previously have been compiled successfully. In the HelloWorld example, the remote object class is HelloServerImpl. RMIC is launched from a Windows NT/95/98 command prompt in the following form: c:\HelloWorld> rmic HelloServerImpl After this command is executed, the Stub and Skeleton classes will be created in the HelloWorld directory, with the names: HelloServerImpl_Skel.class and HelloServerImpl_Stub.class. While creating these classes, the rmic compiler generates the intermediate Java files as HelloServerImpl_Skel.java and HelloServerImpl_Stub.java. You cannot view these files as they are temporary files and rmic will delete these files. If you want to see these files, compile the HelloServerImpl with the following option: c:\HelloWorld> rmic - keepgenerated HelloServerImpl The keepgenerated argument retains the generated java source files for the stubs and skeletons. The stub protocol version can also be specified:
c:\>rmic [options] classfilename c:\>rmic -v1.2 classfilename
Start the RMI registry, server, and client
|
||
|
||
Copyright © 2001 www.universalteacher.com |
||