gpt4 book ai didi

java - 使用 JACOB 时出现 NoSuchMethodError

转载 作者:太空宇宙 更新时间:2023-11-04 08:37:39 26 4
gpt4 key购买 nike

我一直在我的 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 的数组列表,t 是 ITTrack 集合。其中肯定有两个以上的 ITTrack。

谢谢

最佳答案

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

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

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

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

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

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

关于java - 使用 JACOB 时出现 NoSuchMethodError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6009468/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com