【发布时间】:2015-01-07 12:51:51
【问题描述】:
我有一个java程序员,下面一行
service.loadPropertiesForItems(Inbox, new PropertySet(ItemSchema.Subject, ItemSchema.Body));
程序从外部 jar 中调用类和方法。
我想在 python 中编写等效代码,它像我的 java 程序那样调用外部 jar。 使用 Jpype 我实现了代码,但它在以下行失败了
service.loadPropertiesForItems(inbox, ewsPkg.PropertySet(ewsPkg.ItemSchema.Subject, ewsPkg.ItemSchema.Body))
这里的 PropertySet、ItemSchema 是我从外部 jar 中使用的类。 ItemSchema.Subject 和 ewsPkg.ItemSchema.Body 是类类型
运行代码我在上面提到的行出现以下错误-
service.loadPropertiesForItems(inbox, ewsPkg.PropertySet(ewsPkg.ItemSchema.Subject, ewsPkg.ItemSchema.Body))
File "C:\Python27\lib\site-packages\jpype\_jclass.py", line 79, in _javaInit
self.__javaobject__ = self.__class__.__javaclass__.newClassInstance(*args)
RuntimeError: No matching overloads found. at src/native/common/jp_method.cpp:121
谢谢
【问题讨论】:
-
您能否分享一个使用 Jpype 从 Python 执行 jar 的类函数的工作示例。我找不到工作样本,尝试了几个选项但失败并出现错误“不可调用”
标签: java python-2.7 jpype