Get the filePath from Filename using Java

后端 未结 5 913
日久生厌
日久生厌 2021-01-04 05:33

Is there a easy way to get the filePath provided I know the Filename?

5条回答
  •  伪装坚强ぢ
    2021-01-04 06:30

    Look at the methods in the java.io.File class:

    File file = new File("yourfileName");
    String path = file.getAbsolutePath();
    

提交回复
热议问题