Can Java and Python coexist in the same app?

自闭症网瘾萝莉.ら 提交于 2020-01-02 05:40:12

问题


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?


回答1:


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.

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




回答2:


Different versions of an app share a datastore, and AFAIK you can still have a Java version of your app, and Python version, at the same time. It used to be a necessary hack to use features that were implemented in Python but not (yet) in Java, and quite possibly still is.

Of course only one of those versions can be the default, but other versions are accessible.



来源:https://stackoverflow.com/questions/4165824/can-java-and-python-coexist-in-the-same-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!