M
M
MaxLich2017-11-06 15:05:10
Java
MaxLich, 2017-11-06 15:05:10

Why does a java program working with COM4J throw an exception?

Hello. I am learning how to work with COM objects in Java and came across the COM4J library. I found an example of working with this library on the net, here: link . Fulfilled all the points, but at startup an exception is issued. Here is the contents of the console:

Enter text:
test
Exception in thread "main" com4j.ExecutionException: com4j.ComException: 80040154 CoCreateInstance failed : Class not registered : .\com4j.cpp:153
at com4j.ComThread.execute(ComThread.java:203)
at com4j.Task .execute(Task.java:25)
at com4j.COM4J.createInstance(COM4J.java:97)
at com4j.COM4J.createInstance(COM4J.java:72)
at org.limantrade.voc.ClassFactory.createDictionary(ClassFactory.java: 16)
at org.limantrade.Com4j_integrate.initLibrary(Com4j_integrate.java:39)
at org.limantrade.Com4j_integrate.main(Com4j_integrate.java:169)
Caused by: com4j.ComException: 80040154 CoCreateInstance failed : Class not registered : .\com4j .cpp:153
at com4j.Native.createInstance(Native Method)
at com4j.COM4J$CreateInstanceTask.call(COM4J.java:117)
at com4j.COM4J$CreateInstanceTask.call(COM4J.java:104)
at com4j.Task.invoke(Task.java :51)
at com4j.ComThread.run0(ComThread.java:153)
at com4j.ComThread.run(ComThread.java:134)
Process finished with exit code 1

What could it be? How to fix it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
MaxLich, 2017-11-07
@MaxLich

It turned out that it was necessary to run the program under 32-bit Windows, with a 32-bit Java machine. Problem solved.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question