0

I want to write CD/DVD Burning Program in Java. After searching I found this Solution given over here. I followed it but when I run this program I got error :

Exception in thread "main" com4j.ExecutionException: com4j.ComException: 80040111 CoCreateInstance failed : ClassFactory cannot supply requested class : .\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 com.ms.imapi2.ClassFactoryExt.createMsftDiscFormat2Data(ClassFactoryExt.java:16)
    at com.ms.main.MainClass.main(MainClass.java:19)
Caused by: com4j.ComException: 80040111 CoCreateInstance failed : ClassFactory cannot supply requested class : .\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)

Note I am running this program on 64bit Windows 7 with 64bit JVM.

What I tried to solve :

1) I registered com4j.dll using regsvr32

2) Added com4j.dll as Native libraries of com4j.jar

Is there problem in Code or Something else I have to do to make this run.

Community
  • 1
  • 1

1 Answers1

0

You don't need to register com4j.dll in system. Instead this you should register your 3d-part dll.

Also make sure that you have java-classes for working with COM dll. They can be generate by using tlbimp.jar from Com4J folder.

java -jar tlbimp.jar -o "..." -p "..." absolute_path_for_dll

where

  • -o - destination directory, where generated files will be located.
  • -p - java package.

Example of using:

java -jar tlbimp.jar -o C:/projects/com4j/generated -p com.example C:/projects/dll/3d-part.dll

Check tutorial for more information.

Pavel Parshin
  • 507
  • 4
  • 15