This section describes the command-line options that can be used with javareg.
Specifies the name (<class name>) to be registered or unregistered with the class identifier (or with the CLSID generated by javareg if no class identifier is provided).
If this option is specified, either /register or /unregister must also be specified. For example, the following command line will cause javareg to register the Java class Pager:
javareg /register /class:Pager
Because /clsid:<clsid> is not specified, javareg will automatically generate a UUID to be used as the CLSID for the class (it uses the COM API CoCreateGUID).
If you execute javareg again with the same Java class name, javareg will reuse the CLSID already assigned to the Java class. As such, you can execute javareg with additional options later to reconfigure the class (for example, by specifying the /surrogate option).
Specifies the class identifier (<CLSID>) to be registered with the class. Omit this parameter to force javareg to create a CLSID.
For example, the following command will cause javareg to register the Java class Pager using the CLSID {2488D68A-D3BF-11D0-A145-080036006703}:
javareg /register /class:Pager /clsid:{2488D68A-D3BF-11D0-A145-080036006703}
Specifies the base location, either a URL or a directory name, that contains the Java class. This option can be used with /register as a part of registering a JavaBeans object as an ActiveX Control.
Adds the necessary registry information for containers to treat the Java class as an ActiveX Control. This option can be used with /register as a part of registering a JavaBeans object as an ActiveX Control. If you use this option, you must also use /typelib.
Registers an existing typelib, specified in the file name argument of the /typelib option, without creating a new one.
Specifies a ProgID for the class being registered.
By default, javareg does not assign a COM ProgID to your class. This option lets you designate what ProgID to use. For example, the following command will cause javareg to register the Java class Pager and assign it the ProgID called Pager.Java.1.
javareg /register /class:Pager /progid:Pager.Java.1
Quiet mode; suppresses all message boxes. Regardless of whether this option is specified, javareg will return 0 (zero) on success or 1 upon failure.
Registers class specified in the /class parameter with the class identifier specified in /clsid. If you use /register, you must specify at least /class as well. You can, however, also use /register with /class, but without the class identifier. This forces javareg to create a CLSID and register it.
Javareg also recognizes /regserver for this command.
You can use /codebase, /control, and /typelib with /register to register a JavaBean object as an ActiveX Control. Note that if you use /control to register a JavaBean, you must also generate a type library using /typelib as shown in the following example:
javareg /register /class:[classname] /codebase:[filename|URL] /control /typelib:[filename]
Activates the class on a remote server using Distributed Component Object Model (DCOM).
If you want to activate and call a Java class on a different computer using DCOM, use /remote on the client computer. When using this option, the Java class cannot be activated on the client computer—only on the server. The <RemoteServerName> can be any computer identifier supported by distributed COM. Typically, it can be a NetBIOS name, a Domain Name System (DNS) name, or a decimal-dotted IP address.
The following example explains the necessary steps for using this functionality.
class Pager { public boolean Page(String PhoneNumber, String PIN, String Msg) { System.out.println("Page request received. Sending."); System.out.println(" Phone: " + PhoneNumber); System.out.println(" PIN: " + PIN); System.out.println(" Message: " + Msg); return true; } }
javareg /register /class:Pager /progid:Pager.Java.1 /clsid:{2488D68A-D3BF-11D0-A145-080036006703} /surrogate
javareg /register /class:Pager /progid:Pager.Java.1 /clsid: :{2488D68A-D3BF-11D0-A145-080036006703} /remote:yourservername
Now you can use Microsoft® Visual Basic® to create an instance of Pager.Java.1. For example:
Dim x As Object Set x = CreateObject("Pager.Java.1") fSuccess = x.Page ("555-1212", "1234", "Call Home!")
The Pager class will be activated and will run remotely on <RemoteServerName>.
Supports remote access to COM classes. Writes the registry entries required to allow the Java class to be activated out-of-process. This is necessary if you want your Java class to be activated and called from a different computer. In other words, you use the /surrogate option when registering your Java class to run as a DCOM server.
For example, the following command causes javareg to register the Java class Pager so it can be run from a different computer and accessed through DCOM:
javareg /register /class:Pager /clsid:{2488D68A-D3BF-11D0-A145-080036006703} /surrogate
Notice that it is not strictly necessary to specify the CLSID when using /surrogate. If you do not, javareg will generate one.
Generates a type library for a Java class at the specified <filename's> location. To register a typelib without generating a new one, use this option with /nomktyplib. This option can also be used with /register as a part of registering a JavaBeans object as an ActiveX Control.
Unregisters the class specified in the /class parameter. If you specify /unregister, you must specify /class:<classname> as well. Notice that javareg will also recognize /unregserver for this command.
Displays usage information including a list of command-line options.