Using the com4j and iTunes wrappers i can start an instance of iTunes
ClassFactory.createiTunesApp();
from my application and use the api successfully.
But if iTunes is already running independently then it fails with
com4j.ExecutionException: com4j.ComException: 80080005 CoCreateInstance failed : Server execution failed : .\com4j.cpp:153
at com4j.ComThread.execute(ComThread.java:236)
at com4j.Task.execute(Task.java:26)
at com4j.COM4J.createInstance(COM4J.java:99)
at com4j.COM4J.createInstance(COM4J.java:74)
at com.jthink.songkong.itunes.ClassFactory.createiTunesApp(ClassFactory.java:16)
at com.jthink.songkong.ituneshelper.WindowsITunesModelCreator.createITunesModelInternal(WindowsITunesModelCreator.java:42)
at com.jthink.songkong.ituneshelper.ITunesModelCreator.createITunesModel(ITunesModelCreator.java:263)
at com.jthink.songkong.ituneshelper.ITunesModelCreator.run(ITunesModelCreator.java:227)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: com4j.ComException: 80080005 CoCreateInstance failed : Server execution failed : .\com4j.cpp:153
at com4j.Native.createInstance(Native Method)
at com4j.COM4J$CreateInstanceTask.call(COM4J.java:119)
at com4j.COM4J$CreateInstanceTask.call(COM4J.java:106)
at com4j.Task.invoke(Task.java:50)
at com4j.ComThread.run0(ComThread.java:172)
at com4j.ComThread.run(ComThread.java:153)
because iTunes is already running so is there a way I can just connect to an existing iTunes instance rather than trying to create a new one if iTunes is already running ?