This section describes the command-line options that can be used with jactivex.
The auto-offset structures are turned off by default. Turn on the auto-offset structures with /ao+ or /ao to make them more portable between Win32 and Win64 platforms. The auto-offset structures will only work correctly if all fields are fully represented. If any fields are generated as UNMAPPABLE, the Microsoft VM will be unable to determine the correct offset for fields that come after the UNMAPPABLE field. This can lead to corrupted data and access violations.
Exposes OCX files as JavaBeans.
Creates EventInfo entries for all source interfaces (Windows Foundation Classes only).
Specifies the base directory where the package directory will be placed. For example, the following command will create the widgets package directory in the C:\MyPackages directory and place all generated .java files in C:\MyPackages\Widgets.
jactivex /javatlb /d c:\mypackages widgets.tlb
Note When the .tlb is embedded in the .dll as a resource, the following command can also be used:
jactivex /d . /javatlb component.DLL
By default, the base directory is the value specified in the registry HKEY_LOCAL_MACHINE\Software\Microsoft\Java VM\TrustedLibsDirectory. The installation of the Microsoft VM sets this to %Windir%\java\trustlib.
Generate files only for type libraries explicitly listed on the command line. This option allows you to set command-line options on a per-typelib basis. This may cause generation of .java files that reference unresolved names or packages.
If /e is not specified, jactivex will recursively compile type libraries needed to resolve all references.
This option targets the Microsoft VM in the Microsoft SDK for Java version 4.0.
This option generates classes that use features of the 32xx series of the Microsoft virtual machine (Microsoft VM). This option is turned on by default. size_is and iid_is information is propagated from a .tlb file to a Java class file. If you do not place explicit custom attributes in your IDL files (see javaax.h), the generated class will be usable on any Internet Explorer 4.0 or later version of the Microsoft VM.
This enables or disables the generation of size_is and iid_is attributes. The COM iid_is and size_is sample in %SDKDIR%\Samples\COM\iid_is_size_is demonstrates how to create an interface that uses the iid_is and size_is marshaling support of the Microsoft VM and jactivex.
Javatlb compatibility mode accesses COM integration features not available in default mode (generates Java source from type libraries). Use /javatlb to integrate COM objects into Java programs. To access lower-level COM integration features with the jactivex utility, use the /javatlb option and any combination of other options. See Jactivex /javatlb Options for a list of additional options that can be used with /javatlb.
When the .tlb is embedded in the .dll as a resource, both of the following commands work:
/javatlb <file name>.dll /javatlb <file name>.tlb
Generates a text file listing every .java file created by jactivex. This text file can serve as an input file to jvc and can also be used to find out where and what files jactivex created.
For example, the following command line creates a file called mylist.lst, which can then be used as an input file to jvc:
jactivex /javatlb /l myfiles.lst widget.tlb jvc @myfiles.lst
If a relative path is given for the response file, it is placed in the current directory. Its location is not affected by the /d option.
Suppresses the Microsoft copyright message.
Specifies the target directory for .java files generated by jactivex as shown in the following example.
jactivex /javatlb /p gremlinsoft widgets.tlb
This example command line places the .java files in C:\%Windir%\Java\TrustLib\MyCompany\Widgets directory. With this option, you can define a company-specific directory tree that contains the .java files for all the COM objects produced by your company. The package parameter can have multiple levels. For example, the following command would place the .class files in the directory C:\%Windir%\Java\TrustLib\MyCompany\MySample\Widgets.
jactivex /javatlb /p mycompany.mysample widgets.tlb
To use these classes in your Java program, specify an import statement of the following form in your source code:
import mycompany.mysample.widgets.*;
Includes or excludes the base name as the package for the converted class. For example, if you are converting Widgets.tlb to Java classes, this option will create a package called widgets. Because the default is to use the base name as the package, this option is generally followed by a hyphen (-) to disable the automatic creation of the package directory. This places the created .java files in the default package directory (Java\TrustLib or the directory specified in the /d option). For example, the following command places all class files in the C:\MyPackages directory:
jactivex /javatlb /p:b- /d c:\mypackages widgets.tlb
Registers type libraries specified on the command line.
Specifies a .jnf file for type conversions. For more detailed type information on jnf files go to the JNF File Type Information.
Causes jactivex to use the IID of IDispatch instead of using the IID of the default dispinterface. This option is turned on by default.
Disables all warnings.
Sets exit code to Warning.
Exposes .ocx files as WFC controls.
Treats warnings as errors. This prevents any output files from being generated if a warning is reported.
Causes the method declarations and COM declarations to be duplicated in the coclass files. This simplifies using COM objects from Java because default interface methods can be called directly on the object without first casting to an interface pointer. That is, without /xi, the code would look like the following example:
IBeeper b = (IBeeper)new Beeper(); b.beep();
Using /xi, this can be simplified as follows:
Beeper b = new Beeper(); b.beep();
In addition, this form speeds up method invocation. The trade offs are that the coclass files are larger and any manual changes to the information generated by jactivex must be made in both the coclass and the interface.
Disables thread switching. By default, the Microsoft VM assumes that all COM objects passed as parameters are non-thread-safe. The VM also performs background thread-switching to ensure that such objects are called on the correct thread. Using this option disables this extra thread-switching. Use this option when you've designed a new thread-safe COM library.
For coclasses; looks for Control registry key.
Represents unsigned 2-byte integers as char.
Represents void pointers as int.
Displays command-line Help and usage.
This section describes additional jactivex options that can be used with the /javatlb option.
Uses the JavaBeans design pattern for properties. For example, by default, a read-write property named "a" becomes mapped to property accessor methods named "geta" and "puta". If the "/b" flag is specified, the names "getA" and "setA" will be used instead. In addition, the property is exposed to COM by the name "A" only. It is not possible to access the names "getA" or "setA" from COM (these names were exposed only for compatibility with javatlb).
Generates implementation classes for coclass entries; does not generate wrapper classes.
Generates @com.register directives for coclass wrappers (JCWs).
Prevents use of features that are not supported by the virtual machine in Microsoft® Internet Explorer version 3.1. Disabled by default.
Generates Java source files without the extended COM information. As a result, these source files can be browsed more easily and will compile. They will not, however, integrate with COM if they are loaded into the Microsoft VM.
Specifies an optional .jnf file, which supplies extra information on how to convert the type library. The .jnf file is a text file that has the following format:
[Custom] <typename>=<javatype>,<javamarshalertype> ...
The purpose of the .jnf file is to inform jactivex that certain types are to be marshaled using a COM Custom Marshaling hook class. For more detailed type information on jnf files go to the JNF File Type Information.
Maps VT_I2 and VT_UI2 to Java char rather than Java short. By default, these types are mapped to Java short for compatibility with javatlb.
Ignores coclasses in typelib.
Suppresses creation of default versions of the .java files. Jactivex normally creates two .java files for each dispinterface: one that is used when the interface is the default for a coclass, and one that is used when the interface is not the default. The default versions of the java files are needed only to implement the interface using Java. Suppressing the creation of default versions can speed up compilation considerably on large type libraries.
Modifies translation of HRESULT types so that only HRESULT return types that have the high (FAIL) bit set cause Java exceptions. Non-failing HRESULTs (such as S_FALSE) are treated as if they were S_OK.