java - IO错误: FileNotFound when trying to use jython in java

标签 java python jython filenotfoundexception pythoninterpreter

所以我将此文件位于特定目录中。

enter image description here

在这里,我尝试访问我的文件:

public static void main(String[] args) {
    try {
        PythonInterpreter interpreter = new PythonInterpreter();
        interpreter.execfile("C:/Users/schueler/Desktop/TestForPhyton/testPython.py");
    } catch (Exception ex) {
        System.out.println(""+ex);
    }
}

我收到此错误:

IOError: (2, 'File not found - C:\\Users\\schueler\\Desktop\\TestForPhyton\\testPython.py (Das System kann die angegebene Datei nicht finden)')

最佳答案

拼写错误。

testPython.py ==> testPyhton.py(在目录中)

有自动完成工具,IDE可以避免此类错误

关于java - IO错误: FileNotFound when trying to use jython in java,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51185970/

相关文章:

java - 如何调用 Button 元素的另一个 Activity/类 onClick() 中定义的方法?

python - 在 Python 中将 CSS 选择器转换为 XPath

python - Jython & Bottle : SSL-enabled web server

python - 在 jython 中导入 python 模块

java - 使用 Jython 在 Java 中运行 Python 程序

java - 如何通过传递对象类型来创建多个对象?

java - 当我不知道启动时调用了哪个类的main方法时,是否可以在main方法中设置断点?

java - AdMob 广告未显示(使用 Logcat 输出)

python - 使用 applescript 使用 Python 文件中定义的路径变量更改目录

python - 使用Scrapy Python进行登录自动化和爬行