路径path

xiaoxiao2021-02-28  117

public String getCurrentPath(){ //取得根目录路径 String rootPath=getClass().getResource("/").getFile().toString(); //当前目录路径 String currentPath1=getClass().getResource(".").getFile().toString(); String currentPath2=getClass().getResource("").getFile().toString(); //当前目录的上级目录路径 String parentPath=getClass().getResource("../").getFile().toString(); return rootPath; }
转载请注明原文地址: https://www.6miu.com/read-19102.html

最新回复(0)