2014-06-13 3 views
-3

로컬 컴퓨터에서 Excel 파일을 읽으려는 코드를 얻으 려하고 메서드 예외가 발생했습니다. 당신이 게시 한 코드에서fileInputstream 메서드 예외

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) 

답변

1

f1에 대한 선언은 소문자 F를 file 있습니다. 관심있는 수업이 아닌 것 같지만 실수를 한 것 같습니다. F를 대문자로 작성하면 괜찮을 것입니다.

또한 FileInputStream은 File 객체를 생성자 매개 변수로 사용할 수 있으므로 path 변수를 사용하지 않아도됩니다.

+0

Nevermind, 알겠습니다. 도와 주셔서 감사합니다. – user3712347