나는 항아리에 보관하는 정적 클래스라는 메소드에 다음 코드가있다 :FileNotFoundException. 작품과 동시에 작동하지 않습니다?
1 System.out.println(Methods.class.getResource("tagdict.txt"));
2 URL test=Methods.class.getResource("tagdict.txt");
3 System.out.println(test.getPath());
4 TagDictionary dict = new POSDictionary(test.getPath());
첫 번째 System.out을 (1) 말한다 :
rsrc:de/fhg/scai/bio/harsha/classificationworkflow/tagdict.txt
두 번째 System.out에 (2) 말한다 :
de/fhg/scai/bio/harsha/classificationworkflow/tagdict.txt
라인 4는
java.io.FileNotFoundException: de/fhg/scai/bio/harsha/classificationworkflow/tagdict.txt (No such file or directory)
,536 발생
'tagdict.txt'파일은 'Method.class'와 동일한 패키지 (de/fhg/scai/bio/harsha/classificationworkflow)에 있습니다.
파일이 항아리 안에 이미있는 경우에도 4 행에서 FileNotFoundException이 throw되는 이유를 알 수 없습니다.
'POSDictionary'의 생성자에 대한 코드를 작성하는 데 도움이됩니다. 거기에 예외가 발생하기 때문에 도움이됩니다. – Viruzzo