Java, reading a file from current directory?

前端 未结 7 794
自闭症患者
自闭症患者 2020-12-02 06:37

I want a java program that reads a user specified filename from the current directory (the same directory where the .class file is run).

In other words, if the user

7条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-02 07:05

    Try

    System.getProperty("user.dir")
    

    It returns the current working directory.

提交回复
热议问题