Question

I have beeen using JACOB in my java program to work but I run into an error everytime I try to get an ITTrack from an ITTrackCollection.

This is the line that gives the error:

a.add(t.getItem(1));

This is the error:

Exception in thread "AWT-EventQueue-0" java.lang.NoSuchMethodError: com.jacob.com.Dispatch.call(Lcom/jacob/com/Dispatch;Ljava/lang/String;Ljava/lang/Object;)Lcom/jacob/com/Variant;
    at com.dt.iTunesController.ITTrackCollection.getItem(ITTrackCollection.java:42)
    at iq.Main.addSong(Main.java:27)
    at iq.Main$listener.onHotKey(Main.java:70)
    at com.melloware.jintellitype.JIntellitype$1.run(JIntellitype.java:396)
    at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    at java.awt.EventQueue.access$000(Unknown Source)
    at java.awt.EventQueue$1.run(Unknown Source)
    at java.awt.EventQueue$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
com.jacob.com.Dispatch.call(Lcom/jacob/com/Dispatch;Ljava/lang/String;Ljava/lang/Object;)Lcom/jacob/com/Variant;

a is an arraylist of ITTrack and t is an ITTrack collection. t definitely has more than two ITTracks in it.

Thanks

Was it helpful?

Solution

Your code is invoking a method which can not be found in the Dispatch class with the following signature:

Variant call(Dispatch dispatchTarget, String name, Object attributes)

Looking at the Jacob documentation, the following method from that class most closely matches that one:

Variant call(Dispatch dispatchTarget, String name, Object... attributes)

Note that the last parameter is different (vararg - an array of Object).

Did you compile your code against a different version of the library?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top