import java.io.*;
public class test{
public static void main(String[] args) {
// get current dir
File file = new File(System.getProperty("user.dir"));
// get parent dir
String parentPath = file.getParent();
#System.out.println(parentPath);
// get brother dir
String toolPath = parentPath + "/tool";
#System.out.println(toolPath);
}
}
java获取当前目录及父目录和兄弟目录
最新推荐文章于 2023-03-30 20:36:47 发布