I want to be able to call certain methods and such that are contained in a Java jar that is already running (It is guaranteed that it will be running). I have found things like Jython, but those only seem to be able to access Java’s native classes and such.
Share
Check out this: Calling Java from Python
“You could also use Py4J. There is an example on the frontpage and lots of documentation, but essentially, you just call Java methods from your python code as if they were python methods:
As opposed to Jython, one part of Py4J runs in the Python VM so it is always “up to date” with the latest version of Python and you can use libraries that do not run well on Jython (e.g., lxml). The other part runs in the Java VM you want to call.
The communication is done through sockets instead of JNI and Py4J has its own protocol (to optimize certain cases, to manage memory, etc.)“