Let’s say you want to embed Python code in your application. You will use Jython.
pom.xml:
<dependency> <groupId>org.python</groupId> <artifactId>jython-standalone</artifactId> <version>2.7.0</version> </dependency>
*.Java
import org.python.util.PythonInterpreter; import org.python.core.*; private static PythonInterpreter interpreter = new PythonInterpreter(); interpreter = new PythonInterpreter(null, new PySystemState()); //You put the key to register in JavaScript and pass the variable in interpreter.set(KEY, VARIABLE); //If you wanted to use this in the mapper as an example you would pass the key, value and context to the JavaScript function. That way when you write to the context in Python it writes it to the applications context. interpreter.exec(PYTHONCODE);