public static String queryReportPath() {
String os = System.getProperty("os.name");
URL source = FundTools.class.getResource("");
String head = null;
String body = null;
int index = 0;
if (os.equals("Windows XP")) {//windows
body = source.toString();
String protocol = source.getProtocol();
if (protocol.equals("file")) {//tomcat
head = source.getProtocol() + ":/";
} else {//weblogic
String[] strs = body.split("\\.");
head = source.getProtocol() + ":";
body = strs[0] + strs[1].substring(1);
}
body = body.substring(head.length());
body = body.replaceAll("/", "\\\\");
index = body.indexOf("WEB-INF");
body = body.substring(0, index) + "reportfile";
} else {//aix
body = source.getPath();
index = body.indexOf("WEB-INF");
body = body.substring(0, index) + "reportfile";
}
return body;
}
取项目路径的真实地址
最新推荐文章于 2022-02-22 16:45:52 发布