访问文件被拒绝?

时间:2014-07-01 21:00:56

标签: java

所以我有这个JFileChooser:

JOptionPane.showMessageDialog(null, "Navigate into the folder you would like to use for this application's files.");
final JFileChooser fcs = new JFileChooser();
int responses = fcs.showOpenDialog(fcs);
if (responses == JFileChooser.APPROVE_OPTION){
    dir = fcs.getCurrentDirectory().toString();
}else{
    System.exit(1);
}

当我尝试写给dir时,它说

java.io.FileNotFoundException: *Insert path here* (Access is denied)

无论我使用哪个目录,它都会这样做,即使它像文档或桌面一样。我试图做的就是创建一个名为maze.txt的文件,即使我没有使用文件选择器并在代码中给它一个目录,它也会给我带来同样的错误。发生了什么?在我使用mkdir()之后,它突然工作并停止工作;在另一个计划......

0 个答案:

没有答案