dinbhat

Error : Exception in thread "main" com.jacob.com.ComFailException: Can't co-create object

1 post in this topic

Dear All,

I am trying run the following mentioned code. Getting the below mentioned exception . Please help me to resolve this issue.

Exception :

Jacod DLL to use : jacob-1.18-M2-x64.dll
Exception in thread "main" com.jacob.com.ComFailException: Can't co-create object
at com.jacob.com.Dispatch.createInstanceNative(Native Method)
at com.jacob.com.Dispatch.<init>(Dispatch.java:99)
at com.jacob.activeX.ActiveXComponent.<init>(ActiveXComponent.java:58)
at autoitx4java.AutoItX.<init>(AutoItX.java:181)
at KCalc.main(KCalc.java:23)

 

 

 
 
 
Code :
 
import java.io.File;


import autoitx4java.AutoItX;


import com.jacob.com.LibraryLoader;


public class KCalc {


public static void main(String[] args) {
// TODO Auto-generated method stub


String jacobDllVersionToUse;
if (jvmBitVersion().contains("32")) {
jacobDllVersionToUse = "jacob-1.18-M2-x86.dll";
} else {
jacobDllVersionToUse = "jacob-1.18-M2-x64.dll";
}


System.out.println(" Jacod DLL to use : " + jacobDllVersionToUse);
File file = new File("lib", jacobDllVersionToUse);
System.setProperty(LibraryLoader.JACOB_DLL_PATH, file.getAbsolutePath());


AutoItX x = new AutoItX();
x.run("calc.exe");
x.winActivate("Calculator");
x.winWaitActive("Calculator");


}


public static String jvmBitVersion() {
return System.getProperty("sun.arch.data.model");
}


}

 

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now