Java和Python可以在同一个应用程序中共存吗? [英] Can Java and Python coexist in the same app?

查看:715
本文介绍了Java和Python可以在同一个应用程序中共存吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个Java实例直接从Python的实例数据存储中获取数据。我不知道这是否可能。数据存储是透明/唯一的,还是每个实例(如果它们确实可以共存)都有其单独的数据存储?
总结:Java应用程序如何从Python应用程序的数据存储中获取数据,反之亦然?

I need to have a Java instance fetching data directly from the Python's instance datastore. I don't know if that's possible at all. Is the datastore transparent/unique, or each instance (if they can indeed coexist) has its separate datastore? Suming it up: how can a Java app fetch data from the datastore of a Python app, and vice-versa?

推荐答案

您可以使用 jython 。这是一个用java编写的python实现。你可以用这种方式从python调用java函数/类。这将允许您在java实例中运行python代码。

You could use jython. It's a python implementation written in java. You can call java functions/classes from python that way. That would allow you to run python code in the java instance.

我不知道有什么可以做相反的事情(在python进程中运行java)。

I don't know of anything to do the opposite (run java inside a python process).

这篇关于Java和Python可以在同一个应用程序中共存吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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