使用JACOB的NoSuchMethodError

时间:2011-05-15 15:51:44

标签: java jacob

我已经在我的java程序中使用JACOB工作,但每次我尝试从ITTrackCollection获取ITTrack时都会遇到错误。

这是给出错误的行:

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

这是错误:

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是ITTrack的arraylist,t是ITTrack集合。 肯定有两个以上的ITTracks。

由于

1 个答案:

答案 0 :(得分:1)

您的代码正在调用Dispatch类中无法找到的具有以下签名的方法:

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

查看Jacob文档,该类中的以下方法与该类最接近:

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

请注意,最后一个参数是不同的(vararg - 一个Object数组)。

您是否针对不同版本的库编译代码?