how can I invoke a Java code?

M

momobear

A friend of my write a Java program, and I want use it in my python
program as a module. I searched the topic in Google and find maybe the
better way is use GCJ to compile it. Is there any other way for me?
the simple and speediness choice the better. thanks.
 
M

Michael Ekstrand

A friend of my write a Java program, and I want use it in my python
program as a module. I searched the topic in Google and find maybe the
better way is use GCJ to compile it. Is there any other way for me? the
simple and speediness choice the better. thanks.

If you want to run the Java program as a separate process, you can run
"java -jar TheProgram.jar".

If you're wanting to interact with the code, your best option may be
Jython, an implementation of Python in Java.

- Michael
 
M

momobear

If you're wanting to interact with the code, your best option may be
Jython, an implementation of Python in Java.
I do have to interact with Java module, and when talk about Jython,
since I use third parts of python modules I am puzzled about it.
 
J

Jarek Zgoda

momobear napisa³(a):
A friend of my write a Java program, and I want use it in my python
program as a module. I searched the topic in Google and find maybe the
better way is use GCJ to compile it. Is there any other way for me?
the simple and speediness choice the better. thanks.

If the speed is crucial, I suggest compiling the Java code with GCJ,
then write Python extension module for the Java library. This is how the
Lucene indexing library is ported to Python, see
http://pylucene.osafoundation.org/.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top