次のコードを使用して、ファイル StandardQuestions.csv を新しいファイル名にコピーしようとしています:
String standardQuestions = "StandardQuestions.csv";
if(new File(standardQuestions).exists()){
try{
Path source = new File(standardQuestions).toPath();
Path dest = new File(filename).toPath();
Files.copy(source,dest);
}
catch(java.io.IOException e){JOptionPane.showMessageDialog(this,"Error: Input/Output exception.");}
}
Path source = new File(standardQuestions).toPath();
My error message is NoSuchMethodError, method toPath not found in class File.という行にエラーがスローされます。File クラスにこのメソッドがないのはなぜでしょうか? プログラムは 3 ~ 4 台のマシンで正しく実行されますが、1 人のユーザーに対しては常にこのエラーがスローされます。これの原因は何ですか?この質問に答えるために必要な追加情報はありますか?