public static String getRootPath(){
String rootPath = new BaseUtil().getClass().getResource("/").toString()
.replace("file:/", "").replace("WEB-INF/classes/", "");
//获得系统属性
Properties prop = System.getProperties();
String osName = prop.getProperty("os.name");
if(!osName.startsWith("win")&&!osName.startsWith("Win")){
rootPath = "/"+rootPath; //好像这句话是考虑linux系统,具体不了解,囧……
}
return rootPath;
}获取项目根目录
最新推荐文章于 2025-07-07 17:56:44 发布
3387

被折叠的 条评论
为什么被折叠?



