次のようにクラスパスを使用してファイルにアクセスしようとしています:
String path = getClass().getProtectionDomain().getCodeSource()
.getLocation().toString();
File test = new File(path);
File table = new File(test, "testFile.xlsx");
このファイルが同じフォルダーにある場合に、このファイルを読み書きする Jar を作成する必要があるため、これを行っています。
次のエラーが表示されます。
java.io.FileNotFoundException: "myFilepath" (The filename, directory name, or volume label syntax is incorrect)
ファイル ブラウザに myFilepath をコピー アンド ペーストすると、ファイルが表示されます。私が間違っていること、または方法を改善する方法を知っている人はいますか?