Java获取当前路径(Linux+Windows)

整合侠 / 2023-05-10 / 原文

Java获取当前路径(Linux+Windows)

获取当前路径(兼容Linux、Windows):

String curPath = System.getProperty("user.dir");
log.info("===========当前路径===========curPath:{}", curPath);
输出结果:===========当前路径===========curPath:/home/lizhm