Hello Everyone,

I am an intermediate developer in programming languages. I have developed some python script and some java applications. In my project, I need to integrate the python script with a java application to put all the tools in a single pipeline to function as a continuous workflow.

This python script and the java program are completely developed and can work as independent modules in the pipeline. The output of the Python script is a text file which should be read by the java application as an input.

I read about Jython, SWIG & JPype. Can anyone direct/advice me in choosing the effective approach to integrate my applications,other than the command line(CL) invocation.

Jython is slower than Python. Hence, I am hesitant to use Jython as top layer program which can call the python script and the java application sequentially.

And SWIG is for the integration of C/C++ Applications with scripting languages like python/perl and also with java

I would like to appreciate you for reading this posting. Please give me some advice.

Thank you,

> I need to integrate the python script with a java application to put
> all the tools in a single pipeline to function as a continuous workflow

There are a few things I can think of:
- If only one component of the workflow executes at a given time and if the execution of component `n' commences only after the execution of component `n - 1', you can simply create a shell script which sequentially executes the processes. Something like:

python some.py | java pkg.class | java otherpkg.otherclass

But this approach is crude and might not work if there are other complications involved.

- Instead of a Jython wrapper, create a pure Java wrapper which initiates and executes the entire workflow. You can try embedding the Python interpreter to execute your Python scripts from Java.

- Don't believe the FUD floating around about Jython being slow; try it for your application and see if it works out within the given expectations. Using a recent JVM [1.6] and the latest Jython build might help speed things up.

I just want to be pointed in the right direction. I am new to java but know enough python to get myself into trouble. I am writing some scripts that work with a program and so it has to be in java. I was wondering though. can't I just initiate a java script that then runs a more streamlined python script and then returns to the java...?

any advice?

This article has been dead for over six months. Start a new discussion instead.