import javax.script.*;
import org.python.core.PyFunction;
import org.python.core.PyInteger;
import org.python.core.PyObject;
import org.python.util.PythonInterpreter;
import java.io.*;
import static java.lang.System.*;
public class FirstJavaScript
{
public static void main(String args[])
{
PythonInterpreter interpreter = new PythonInterpreter();
interpreter.execfile("C:\\Python27\\programs\\my_utils.py");
PyFunction func = (PyFunction)interpreter.get("adder",PyFunction.class);
int a = 2010, b = 2 ;
PyObject pyobj = func.__call__(new PyInteger(a), new PyInteger(b));
System.out.println("anwser = " + pyobj.toString());
}//main
}
如果解决了您的问题请采纳!
如果未解决请继续追问