jarにアーカイブされているMethodsという静的クラスに次のコードがあります。
System.out.println(Methods.class.getResource("tagdict.txt")); // 1
URL test = Methods.class.getResource("tagdict.txt"); // 2
System.out.println(test.getPath()); // 3
TagDictionary dict = new POSDictionary(test.getPath()); // 4
最初のSystem.out(1)は言う:
rsrc:de/fhg/scai/bio/harsha/classificationworkflow/tagdict.txt
2番目の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)
ファイルtagdict.txtは、と同じパッケージに配置されます。つまりMethod.class、ですde/fhg/scai/bio/harsha/classificationworkflow。
FileNotFoundExceptionファイルがすでにjar内で見つかったのに、4行目でがスローされる理由がわかりません。