从Python调用Java代码的最佳方法是什么? [英] What is the best way to call Java code from Python?

查看:134
本文介绍了从Python调用Java代码的最佳方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Java类库(第三方,专有),我希望我的python脚本调用它的函数。我已经有了使用这个库的java代码。实现这一目标的最佳方法是什么?

I have a Java class library (3rd party, proprietary) and I want my python script to call its functions. I already have java code that uses this library. What is the best way to achieve this?

推荐答案

您可以在 Jython ?如果是这样,这可能是最好的方法,因为Java库可以作为可编写脚本的对象直接暴露给Jython。

Can you run your current Python scripts under Jython ? If so, that's probably the best way, since the Java library can be exposed directly into Jython as scriptable objects.

如果不这样做,列出了许多解决方案这里

Failing that, there are a number of solutions listed here.

这篇关于从Python调用Java代码的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆