In the Java project file, to invoke some of the results of Python processing, you can use the Jython jar package, which you can use to download the latest Jar packs in http://www.jython.org/downloads.html, and you can choose a lower version if you are stable.
After downloading into the project engineering directory and configuration, wrote a test code as follows:
Import Org.python.util.PythonInterpreter;
Import org.python.core.PyException;
public class MyTest {
/**
* Test
/public static void main (string[] args) throws Pyexception {
Pytho Ninterpreter interp = new Pythoninterpreter ();
Interp.execfile ("python/tt.py");
Interp.close ();
}
Click Run to report an error: Exception in thread "main" Java.lang.Error: Unresolved compilation problem: Pythoninterpreter cannot resolve to type syntax error ..., as follows:
According to the hint, can be judged is Jython interpreter out of the question, choose Eclipse->windows->preference->pydev->interpreter->jython interpreter, Click New to add the downloaded Jython jar package, as shown in the figure:
When you're done, and then click Run, you can get a handle on the Python statement, as shown in figure:
There is an output statement in tt.py, there is a warning of character encoding, there is no effective method processing, the version reduced to 2.5 will not be prompted.