These will work with out a problem, also other calls to office libraries.
Then I tried to use a COM server written in C# and .Net Framework 2.0: the COM-Interop Part 2 sample from VS2008. Calling the COM from C++ as in the sample is no problem, but from JACOB I get an error:
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:101)
at com.jacob.activeX.ActiveXComponent.<init>(ActiveXComponent.java:58)
at de.IPSysteme.thd.test.ComTest.main(ComTest.java:28)
What is wrong?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi
As a beginner with JACOB I tried first the following code:
import com.jacob.com.*;
import com.jacob.activeX.*;
public class ComTest {
/**
* @param args
*/
public static void main(String[] args) {
ActiveXComponent xl = new ActiveXComponent("Excel.Application");
Object xlo = xl.getObject();
try {
System.out.println("version="+xl.getProperty("Version"));
} catch (Exception e) {
e.printStackTrace();
} finally {
xl.invoke("Quit", new Variant[] {});
}
}
}
These will work with out a problem, also other calls to office libraries.
Then I tried to use a COM server written in C# and .Net Framework 2.0: the COM-Interop Part 2 sample from VS2008. Calling the COM from C++ as in the sample is no problem, but from JACOB I get an error:
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:101)
at com.jacob.activeX.ActiveXComponent.<init>(ActiveXComponent.java:58)
at de.IPSysteme.thd.test.ComTest.main(ComTest.java:28)
What is wrong?
The solution was not so hard:
.Net COM objects have to be local or in the GAC...