Embedded Python in Java / Coldfusion?

738 views Asked by At

I've been trying to excute a Python script from Java or Coldfusion framework (which runs on a JVM), The most documented solution is Jython but it only runs on Python 2.7 which is a problem because I need to use some librairies that runs only on Python 3 .

The JEP (https://github.com/ninia/jep) / JPY (https://github.com/bcdev/jpy) repositories on github really fits my needs but they are not quite responsives to the Github issues .

Has anyone ever done something similar before ?

2

There are 2 answers

1
Curtis On

Unless you really need to embed jython into your application, you may execute a system command (e.g. run a python script) from Java using the method described here.

0
Klodovsky On

The issue with Jep wasn't any syntax error, for example jep.eval(' some Python code'); was supposed to run that Python code in Java, If your system environement is well configured then what's left to do is to redirect use Jep's Python redirect_stream() function to redirect the flow of your IDE, worked for me finally .