我正在尝试将Jython安装到IntelliJ Java程序中。这是如何做到的呢?我在这里默认情况下安装了Jython : C:\jython2.7.2,并安装了Python。选择此目录或其bin,会出现此错误。
所选目录不是JDK的有效主页。
最后,我想利用PythonInterpreter,
https://stackoverflow.com/a/8899042/15358601
PythonInterpreter interpreter = new PythonInterpreter();
interpreter.exec("import sys\nsys.path.append('pathToModules if they are not there by default')\nimport yourModule");
// execute a function that takes a string and returns a string
PyObject someFunc = interpreter.get("funcName");
PyObject result = someFunc.__call__(new PyString("Test!"));
String realResult = (String) result.__tojava__(String.class);发布于 2021-03-15 15:25:43
您应该选择JDK主dir,而不是jython home dir。示例:C:\ProgramFiles\Java\jdk1.8.0_112
https://stackoverflow.com/questions/66611059
复制相似问题