I am facing exception Exception in thread "main" com.jacob.com.ComFailException: Can't co-create object
while running the code below.
I checked online for help. Some sites say that I need to register my dll. I tried registering using regsvr32.exe
. But I am unable to register successfully. Getting below popup.
The module "jacob-1.18-M2-x64.dll" was loaded but the entry-point DllRegisterServer was not found.Make sure that "jacob-1.18-M2-x64.dll" is a valid DLL or OCX file and then try again.
1.) You don't need to register the jacob-dll, it just has to be somewhere on your java.library.path. It is the dll that contains the COM-object that has to be registered.
2.) If the COM-dll is registered you have to take care to use the correct JVM with the library. 32-bit-dlls will work only with a 32-bit-JVM, 64-bit-dlls only with a 64-bit-jvm. Using the wrong JVM will result in the Can't co-create object
error.
I had the same problem and this is how I fixed it:
I encounted same problem and solved like following this. 1.Set lib path of jacob.jar 2.Copy jacob-x86.dll(or 64bit case jacob-x64.dll) to System32 directory.
import com.jacob.activeX.ActiveXComponent;
ActiveXComponent activeXComponent = new ActiveXComponent("ACTIVEX.ActiveXCtrl.1");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.