关于#java#的问题:最近刚完成CS61B Proj2 BYog在去gradescope提交的时候, 在save game 和 loadgame 这个功能这里报错了

各位xdm好, 本人,最近刚完成CS61B Proj2 BYog
在去gradescope提交的时候, 在save game 和 loadgame 这个功能这里报错了

img


我查了下说是没有权限 ,也去jvm里设置了 但是也没有用, 有没有也做过相关课程的xdm懂得怎么解决

这是save 和load 那一块的代码


private void saveGame() {
        File f = new File("./Game.ser");
        try {
            if (!f.exists()) {
                f.createNewFile();
            }
            FileOutputStream fs = new FileOutputStream(f);
            ObjectOutputStream os = new ObjectOutputStream(fs);
            os.writeObject(this);
            os.close();
        } catch (FileNotFoundException e) {
            System.out.println("file not found");
            System.exit(0);
        } catch (IOException e) {
            System.out.println(e);
            System.exit(0);
        }
    }
 private static Game getSavedGame() {
        File f = new File("./Game.ser");
        if (f.exists()) {
            try {
                System.out.println("Readable: " + f.canRead());
                FileInputStream fs = new FileInputStream(f);
                ObjectInputStream os = new ObjectInputStream(fs);
                return (Game) os.readObject();
            } catch (FileNotFoundException e) {
                System.out.println("file not found");
                System.exit(0);
            } catch (IOException e) {
                System.out.println(e);
                System.exit(0);
            } catch (ClassNotFoundException e) {
                System.out.println("class not found");
                System.exit(0);
            }
        }
        return null;
    }

运行这个jar工程的用户没有Game.ser的读取权限

破案了 是我的输出文档格式 不是txt 家人们