dinbhat Posted February 12, 2015 Share Posted February 12, 2015 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 : expandcollapse popupimport 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"); } } Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now