【问题标题】:fileInputstream method exception文件输入流方法异常
【发布时间】:2014-06-13 17:02:28
【问题描述】:

我试图让我的代码从本地计算机读取一个 excel 文件,它给了我一个方法异常。

file f1 = new File("C://documents//test//testfile.xls")
path = f1.getAbsolutePath("C://documents//test//testfile.xls")
FileInputStream fis = new FileInputStream(path);


Caught: groovy.lang.MissingMethodException: No signature of method: static.com.genologics.client.bartender.midscript.file() is applicable for argument types: (java.io.File) values: [C:\documents\test\testfile.xls]
Possible solutions: find(), find(groovy.lang.Closure), use([Ljava.lang.Object;), is(java.lang.Object), with(groovy.lang.Closure), wait()
groovy.lang.MissingMethodException: No signature of method: static com.genologics.client.bartender.midscript.file() is applicable for argument types: (java.io.File) values: [C:\documents\test\testfile.xls]
Possible solutions: find(), find(groovy.lang.Closure), use([Ljava.lang.Object;), is(java.lang.Object), with(groovy.lang.Closure), wait()
    at com.genologics.client.bartender.midscript.main(CSVandManifestGenerator.groovy:43)

【问题讨论】:

    标签: java grails groovy fileinputstream


    【解决方案1】:

    在您发布的代码中,您对f1 的声明具有带有小写f 的file。这可能不是您感兴趣的课程,但我可能弄错了。大写F,你应该没问题。

    此外,您可以取消 path 变量,因为 FileInputStream 接受 File 对象作为构造函数参数。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多