简体   繁体   中英

How to create an object using JACOB

I managed to load two dll's

    System.load("C:\\Program Files (x86)\\EXAMPLE Client\\Bin\\EXAMPLE.Client.SDK.dll");
    System.load("C:\\Program Files (x86)\\EXAMPLE Client\\Bin\\EXAMPLE.Common.SDK.dll");

Next step is to create on object calls SDKModel . How do I do this? I tried:

ActiveXComponent example = new ActiveXComponent("EXAMPLE.Common.SDK.SDKModel");

But then I get the following exception:

Exception in thread "main" com.jacob.com.ComFailException: Can't get object clsid from progid

I'm unsure whether I'm on the right track. How would create the object SDKModel ?

Its because you didn't registered your dll in system. Check path of cd in both code

To register follow [important: Be careful using regasm.exe as it different file than unregister]

c:
cd\
cd C:\Windows\Microsoft.NET\Framework64\v2.0.50727 
RegAsm /verbose /nologo /codebase D:\path_to_dll\mydll.dll

To unregister follow

c:
cd\
cd C:\Windows\Microsoft.NET\Framework\v2.0.50727
RegAsm.exe /unregister D:\path_to_dll\mydll.dll

Update:

To register / Unregister use C:\\Windows\\Microsoft.NET\\Framework\\v2.0.50727 framework..

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM