1rmic(1) General Commands Manual rmic(1)
2
3
4
6 rmic - The Java RMI Compiler
7
8 rmic generates stub, skeleton, and tie classes for remote objects using
9 either the JRMP or IIOP protocols. Also generates OMG IDL.
10
12 rmic [ options ] package-qualified-class-name(s)
13
14
16 The rmic compiler generates stub and skeleton class files (JRMP proto‐
17 col) and stub and tie class files (IIOP protocol) for remote objects.
18 These classes files are generated from compiled Java programming lan‐
19 guage classes that are remote object implementation classes. A remote
20 implementation class is a class that implements the interface
21 java.rmi.Remote. The class names in the rmic command must be for
22 classes that have been compiled successfully with the javac command and
23 must be fully package qualified. For example, running rmic on the class
24 file name HelloImpl as shown here:
25
26 rmic hello.HelloImpl
27
28
29 creates the HelloImpl_Stub.class file in the hello subdirectory (named
30 for the class's package).
31
32 A skeleton for a remote object is a JRMP protocol server-side entity
33 that has a method that dispatches calls to the actual remote object
34 implementation.
35
36 A tie for a remote object is a server-side entity similar to a skele‐
37 ton, but which communicates with the client using the IIOP protocol.
38
39 A stub is a client-side proxy for a remote object which is responsible
40 for communicating method invocations on remote objects to the server
41 where the actual remote object implementation resides. A client's ref‐
42 erence to a remote object, therefore, is actually a reference to a
43 local stub.
44
45 By default, rmic generates stub classes that use the 1.2 JRMP stub pro‐
46 tocol version only, as if the -v1.2 option had been specified. (Note
47 that the -vcompat option was the default in releases prior to 5.0.) Use
48 the -iiop option to generate stub and tie classes for the IIOP proto‐
49 col.
50
51 A stub implements only the remote interfaces, not any local interfaces
52 that the remote object also implements. Because a JRMP stub implements
53 the same set of remote interfaces as the remote object itself, a client
54 can use the Java programming language's built-in operators for casting
55 and type checking. For IIOP, the PortableRemoteObject.narrow method
56 must be used.
57
59 -bootclasspath path
60 Overrides location of bootstrap class files
61
62 -classpath path
63 Specifies the path rmic uses to look up classes. This option
64 overrides the default or the CLASSPATH environment variable if it
65 is set. Directories are separated by colons. Thus the general
66 format for path is:
67 For example:
68
69 -d directory
70 Specifies the root destination directory for the generated class
71 hierarchy. You can use this option to specify a destination
72 directory for the stub, skeleton, and tie files. For example, the
73 command
74 % rmic -d /java/classes foo.MyClass
75 would place the stub and skeleton classes derived from MyClass
76 into the directory /java/classes/foo. If the -d option is not
77 specified, the default behavior is as if "-d ." were specified:
78 the package hierarchy of the target class is created in the cur‐
79 rent directory, and stub/tie/skeleton files are placed within it.
80 (Note that in some previous versions of rmic, if -d was not spec‐
81 ified, then the package hierarchy was not created, and all of the
82 output files were placed directly in the current directory.)
83
84
85 -extdirs path
86 Overrides location of installed extensions
87
88 -g Enables generation of all debugging information, including local
89 variables. By default, only line number information is generated.
90
91 -idl
92 Causes rmic to generate OMG IDL for the classes specified and any
93 classes referenced. IDL provides a purely declarative, program‐
94 ming language-independent way of specifying an object's API. The
95 IDL is used as a specification for methods and data that can be
96 written in and invoked from any language that provides CORBA
97 bindings. This includes Java and C++ among others. See the Java
98 Language to IDL Mapping @
99 http://www.omg.org/technology/documents/formal/java_language_map‐
100 ping_to_omg_idl.htm (OMG) document for a complete description.
101 When the -idl option is used, other options also include:
102
103 -always or -alwaysgenerate
104 Forces re-generation even when existing stubs/ties/IDL are
105 newer than the input class.
106
107 -factory
108 Uses factory keyword in generated IDL.
109
110 -idlModule fromJavaPackage[.class] toIDLModule
111 Specifies IDLEntity package mapping. For example: -idlModule
112 foo.bar my::real::idlmod.
113
114 -idlFile fromJavaPackage[.class] toIDLFile
115 Specifies IDLEntity file mapping. For example: -idlFile
116 test.pkg.X TEST16.idl.
117
118 -iiop
119 Causes rmic to generate IIOP stub and tie classes, rather than
120 JRMP stub and skeleton classes. A stub class is a local proxy for
121 a remote object and is used by clients to send calls to a server.
122 Each remote interface requires a stub class, which implements
123 that remote interface. A client's reference to a remote object is
124 actually a reference to a stub. Tie classes are used on the
125 server side to process incoming calls, and dispatch the calls to
126 the proper implementation class. Each implementation class
127 requires a tie class.
128 Invoking rmic with the -iiop generates stubs and ties that con‐
129 form to this naming convention:
130 _<implementationName>_stub.class
131 _<interfaceName>_tie.class
132 When the -iiop option is used, other options also include:
133
134 -always or -alwaysgenerate
135 Forces re-generation even when existing stubs/ties/IDL are
136 newer than the input class.
137
138 -nolocalstubs
139 Do not create stubs optimized for same-process clients and
140 servers.
141
142 -noValueMethods
143 Must be used with the -idl option. Prevents addition of value‐
144 type methods and initializers to emitted IDL. These methods
145 and initializers are optional for valuetypes, and are gener‐
146 ated unless the -noValueMethods option is specified when using
147 the -idl option.
148
149 -poa
150 Changes the inheritance from org.omg.CORBA_2_3.porta‐
151 ble.ObjectImpl to org.omg.PortableServer.Servant. The Porta‐
152 bleServer module for the Portable Object Adapter @
153 http://docs.oracle.com/javase/7/docs/tech‐
154 notes/guides/idl/POA.html (POA) defines the native Servant
155 type. In the Java programming language, the Servant type is
156 mapped to the Java org.omg.PortableServer.Servant class. It
157 serves as the base class for all POA servant implementations
158 and provides a number of methods that may be invoked by the
159 application programmer, as well as methods which are invoked
160 by the POA itself and may be overridden by the user to control
161 aspects of servant behavior. Based on the OMG IDL to Java Lan‐
162 guage Mapping Specification, CORBA V 2.3.1 ptc/00-01-08.pdf.
163
164 -J Used in conjunction with any java option, it passes the option
165 following the -J (no spaces between the -J and the option) on to
166 the java interpreter.
167
168 -keep or -keepgenerated
169 Retains the generated .java source files for the stub, skeleton,
170 and/or tie classes and writes them to the same directory as the
171 .class files.
172
173 -nowarn
174 Turns off warnings. If used the compiler does not print out any
175 warnings.
176
177 -nowrite
178 Does not write compiled classes to the file system.
179
180 -vcompat
181 Generates stub and skeleton classes compatible with both the 1.1
182 and 1.2 JRMP stub protocol versions. (This option was the default
183 in releases prior to 5.0.) The generated stub classes will use
184 the 1.1 stub protocol version when loaded in a JDK 1.1 virtual
185 machine and will use the 1.2 stub protocol version when loaded
186 into a 1.2 (or later) virtual machine. The generated skeleton
187 classes will support both 1.1 and 1.2 stub protocol versions. The
188 generated classes are relatively large in order to support both
189 modes of operation.
190
191 -verbose
192 Causes the compiler and linker to print out messages about what
193 classes are being compiled and what class files are being loaded.
194
195 -v1.1
196 Generates stub and skeleton classes for the 1.1 JRMP stub proto‐
197 col version only. Note that this option is only useful for gener‐
198 ating stub classes that are serialization-compatible with
199 pre-existing, statically-deployed stub classes that were gener‐
200 ated by the rmic tool from JDK 1.1 and that cannot be upgraded
201 (and dynamic class loading is not being used).
202
203 -v1.2
204 (default) Generates stub classes for the 1.2 JRMP stub protocol
205 version only. No skeleton classes are generated with this option
206 because skeleton classes are not used with the 1.2 stub protocol
207 version. The generated stub classes will not work if they are
208 loaded into a JDK 1.1 virtual machine.
209
210
212 CLASSPATH
213 Used to provide the system a path to user-defined classes. Direc‐
214 tories are separated by colons. For example,
215
216
218 java(1), javac(1), CLASSPATH @
219 http://docs.oracle.com/javase/7/docs/technotes/tools/index.html#class‐
220 path
221
222 16 Mar 2012 rmic(1)