how to call java methods in python

Laszlo Nagy gandalf at shopzeus.com
Tue Oct 4 06:56:12 EDT 2011


> Please help me
>
> Regarding how to create java bridge as how to call a java function
> from python
If you want to call a Java *method* from the C python implementation, 
then there are many possibilities. For example, you can write your Java 
program as a service. The Python program can talk to it through some 
kind of IPC mechanism. There are lots of ways to do communication 
between two running processes.

Lower lever would be (just an example) to open a TCP/IP server socket on 
the Java side, and connect to it from the Python side. Then develop your 
own protocol for communication.

Higher level would be (just another example) to use CORBA/ORB on the 
Java side, and do the same from the Python side.

There are dozens of libraries that can help you communicate between 
processes. I suggest that you look after these libraries, and select one 
that suits your needs.

If you want to call Java methods that run inside the same process with 
Python then I have bad news. This won't be possible. (Or it might be, 
but don't worth the work...)

Best,

    Laszlo






More information about the Python-list mailing list