您嵌入了jython,将使用一些Python模块:
如果要在Java代码中设置路径(sys.path):
public void init() { interp = new PythonInterpreter(null, new PySystemState()); PySystemState sys = Py.getSystemState(); sys.path.append(new PyString(rootPath)); sys.path.append(new PyString(modulesDir)); }Py在org.python.core中。
rootPath和modulesDir是您想要的地方!
让rootPath指向标准jython-lib所在的位置
例如,查看Jython-Source-Code中的src / org / python / util / PyServlet.java



