问题
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
?
回答1:
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..
来源:https://stackoverflow.com/questions/16144511/how-to-create-an-object-using-jacob