private static String getXMLPath() throws Exception{
String path = "";
path=Thread.currentThread().getContextClassLoader().getResource("").toURI().getPath();
System.out.println("source path:"+path);
path=path.replace("/", File.separator); // 将/换成\
path=path.replace("file:", ""); //去掉file:
path=path.replace("classes"+File.separator, ""); //去掉class\
if(path.indexOf(":") != -1){
path=path.substring(1); //去掉第一个\,如 \D:\JavaWeb...
}
path+="config"+File.separator+"other"+File.separator+"ipsLimit.xml";
// path += File.separator+path;
System.out.println("PATH=:"+path);
return path;
}
String path = "";
path=Thread.currentThread().getContextClassLoader().getResource("").toURI().getPath();
System.out.println("source path:"+path);
path=path.replace("/", File.separator); // 将/换成\
path=path.replace("file:", ""); //去掉file:
path=path.replace("classes"+File.separator, ""); //去掉class\
if(path.indexOf(":") != -1){
path=path.substring(1); //去掉第一个\,如 \D:\JavaWeb...
}
path+="config"+File.separator+"other"+File.separator+"ipsLimit.xml";
// path += File.separator+path;
System.out.println("PATH=:"+path);
return path;
}