3

My environment is Java 7, on Windows 7 - 64 bit. So here's my requirement and procedures I followed

  1. I wanted to execute a library called test.dll from Java
  2. I first downloaded the latest version of jacob, and put them within a folder, which is included in the Windows environment variable PATH.
  3. I registered the test.dll using regsvr32.exe under C:\Windows\SysWOW64 (it was successful!)
  4. I am running jacob from a webapp, so I made sure that WEB-INF/lib has jacob.jar in it.
  5. I also set a java System property - -Djava.library.path=c:/dev/jacob/jacob-1.17-x64.dll (This is where I have kept the jacob-1.17-x64.dll)

still I am facing

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)

I have gone through many of the SO posts but none of them have helped me so far

can anyone please guide me to the solution?

Community
  • 1
  • 1
sanbhat
  • 17,522
  • 6
  • 48
  • 64
  • i was getting this error on running `new ActiveXComponent("Word.Application")`. this was gone when I ran the application with a user with admin privileges, strange. Mine was all 32 bit (windows, jdk and office) with jacob-1.14.3 – mzzzzb Aug 14 '15 at 12:28

2 Answers2

4

A similar problem for me was solved by changing the jdk from a 64-bit to 32-bit.

0

Looking at the source code of Jacob Dispatch, line 99 (http://jacob-project.cvs.sourceforge.net/viewvc/jacob-project/jacob/src/com/jacob/com/Dispatch.java?revision=1.18&view=markup), the error is not within Jacob (at least not the Java code). Before digging into the Jacob native code, I would try to create this COM object in another container, say an Excel macro or Windows Scripting Host. I believe you will find the same error, or at least will be able to determine if Jacob is the culprit or not. I suspect not.

Tony BenBrahim
  • 7,040
  • 2
  • 36
  • 49