【问题标题】:using python module in java with jython在java中使用python模块和jython
【发布时间】:2010-10-13 05:27:21
【问题描述】:

我希望在我的 Java 应用程序中使用现有 Python 项目中的几个 Python 模块。

我找到了article 并按照那里提到的步骤进行操作。特别需要导入java接口:

package jyinterface.interfaces;

public interface EmployeeType {
    .
    .
}

进入模块:

from jyinterface.interfaces import EmployeeType

class Employee(EmployeeType)

我有一个问题 - 使用这种方法,这是否意味着在进行更改后我无法在现有的 python 项目中使用这个模块,即使使用 Jython 或 Python 解释器也是如此?

【问题讨论】:

    标签: java python jython


    【解决方案1】:

    您可以将它与 Jython 一起使用,但不能与标准实现 CPython 一起使用。

    然而,当您使用 CPython 时,努力提供对 java 类库的完全访问。

    【讨论】:

    • 我曾尝试将我的 python 模块用作 Jython 的独立模块,但我遇到了 importError 的行“from jyinterface.interfaces import EmployeeType”
    猜你喜欢
    • 2021-04-19
    • 2011-03-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-04-05
    • 1970-01-01
    相关资源
    最近更新 更多