java.io.FileNotFoundException: (No such file or directory) when running from eclipse

前端 未结 2 1000
盖世英雄少女心
盖世英雄少女心 2021-02-20 13:55

I am writing to a file and want console output,

// TODO Create a game engine and call the runGame() method
public static void main(String[] args) throws Exceptio         


        
2条回答
  •  旧时难觅i
    2021-02-20 14:28

    The file should be in contained within the root of your project.

    When you execute a project in eclipse, the working directory is the most top level of your project.

    Right click your project, click New>File, and make a txt file called "TheGame.txt".

提交回复
热议问题