Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create an object using JACOB

Tags:

java

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?

like image 720
Roel Veldhuizen Avatar asked Sep 10 '26 22:09

Roel Veldhuizen


1 Answers

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..

like image 106
Vicky Thakor Avatar answered Sep 13 '26 13:09

Vicky Thakor



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!