Python and Java

Ravi Teja webraviteja at gmail.com
Mon Mar 6 22:51:00 EST 2006


For most purposes Jython 2.1 is just fine. The lack of recent features
is not a show stopper. What do you need metaclasses? decorators? BTW,
there is Jython 2.2 as an alpha release.

There are a number of ways you can use Java code through Python.

Use JPype to start a Java VM
http://jpype.sourceforge.net/

Or compile using GCJ and expose as a DLL/SO or better yet, make a SWIG
extension.
A good example for this is PyLucene.
Python/Java Wrapper Generator
http://www.rexx.com/~dkuhlman/generate_wrappers.html
simplifies the process.

Or use some standard interop mechanism. Write an XMLRPC/SOAP/CORBA and
script via Python. This is similar to the COM approach.

Or maybe, you can look into XPCOM. I have no experience with it.

And finally a bit more perverse approach that I used once. Converted
Java bytecode to CIL with IKVM.
http://www.ikvm.net/
And then I used Python for .NET
(http://www.zope.org/Members/Brian/PythonNet),  a really well
implemented integration module if I ever saw one, to access the code.




More information about the Python-list mailing list