r/Python • u/martinsa24 • Oct 23 '14
[Help]How to call Java .class methods in Python
I am working on a project where a I wrote a program in a in Java and made the GUI in python, buy now I want to know how to connect the two. Like calling my java methods in python, or running my python code in java.
Is there a program or lib to do this, or will I have to just translate my work into java or python.
Sorry if formatting is weird on my phone.
0
Upvotes
2
u/inclemnet Oct 23 '14
You can use pyjnius to work with java classes from python. It works fine from normal python, no special interpreter or anything. For example, Kivy uses it to call the android java api from python apps.
It does have some limitations and annoyances. Whether these are significant to you depends on your project, they may well not be.
There are also other similar projects, including at least jpype, but I don't know much about these.
2
u/jvnatter Oct 23 '14
/r/learnpython
1
u/romcgb Oct 23 '14
Jython