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

发布时间 2023-05-10 08:58:20作者: 整合侠

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

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

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