For a legacy project with MS Word integration, we have generated Java wrapper files using the com4j Java/COM bridge (https://com4j.kohsuke.org/) version 20110320 a long time ago.
Now I am trying to re-build these files with the same version of com4j and tlbimp, using an existing Ant script.
The Ant build fails with the message:
The type library “{00020905-0000-0000-C000-000000000046}” <8.7> has no
win32 binary: 2 incorrect key name
“TypeLib{00020905-0000-0000-C000-000000000046}8.7win32”
For the CLSID entry in the registry I see only a HKLMSOFTWAREClassesTypeLib{00020905-0000-0000-C000-000000000046}8.7Win64
sub-key. The entry points to the file C:Program FilesMicrosoft OfficeRootOffice16MSWORD.OLB
.
(I assume that the win32
registry entry does not exist because my version of MS Word is only a x64 version.)
In the source code of the tlbimp class TypeLibInfo, I see that the win32
part is hard-coded
String fileName;
try {
fileName = Native.readRegKey(verKey+"\"+lcid+"\win32");
} catch( ComException e ) {
throw new BindingException(Messages.NO_WIN32_TYPELIB.format(libid,version),e);
}
End of stack trace is:
Caused by: com4j.ComException: 2 incorrect key name "TypeLib{00020905-0000-0000-C000-000000000046}8.7win32" : Das System kann die angegebene Datei nicht finden. : .registry.cpp:35
at com4j.tlbimp.Native.readRegKey(Native Method)
at com4j.tlbimp.TypeLibInfo.locate(TypeLibInfo.java:111)
Is this a known limitation of the tlbimp tool? Is there a workaround?