I have a Java project which uses Java to access some 3rd party libraries. For other things I'd like to use something newer like Python maybe. Is it easy to incorporate into an existing project? How do people usually do that?
closed as not constructive by Yannis Rizos♦ Mar 25 '12 at 0:31
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.
It's quite easy to integrate Python with Java. You can start with Jython : http://wiki.python.org/jython/WhyJython
This is the way Oracle implemented WLST for they Weblogic server so it's quite a stable technology.
As described in the FAQ :
Is Jython the same language as Python?
Yes. Jython is an implementation of the Python language for the Java platform. Jython 2.5 implements the same language as CPython 2.5, and nearly all of the Core Python standard library modules. (CPython is the C implementation of the Python language.) Jython 2.5 uses the same regression test suite as CPython, with some minor modifications.
There are a number of differences. First, Jython programs cannot currently use CPython extension modules written in C. These modules usually have files with the extension .so, .pyd or .dll. If you want to use such a module, you should look for an equivalent written in pure Python or Java. However, it is technically feasible to support such extensions, as demonstrated by IronPython. For the next release of Jython, we plan to support the C Python Extension API.
There are a number of other differences between the two implementations that are unlikely to go away. These range from the trivial - Jython's code objects currently do not have a co_code attribute because it is not possible to directly access Java bytecode from a class, without loading the file; to the significant - Jython uses Java's true garbage collection rather than Python's reference counting scheme.