Converting Relative Paths to Absolute Paths

前端 未结 9 1247
北荒
北荒 2020-12-05 04:14

I have an absolute path to file A.

I have a relative path to file B from file A\'s directory. This path may and will use \"..\" to go up the directory structure in

9条回答
  •  独厮守ぢ
    2020-12-05 05:00

    String absolutePath = FileSystems.getDefault().getPath(mayBeRelativePath).normalize().toAbsolutePath().toString();
    

提交回复
热议问题