1/**
2* 获得项目所在路径
3* @return String
4*/
5public static String getPath()
6 {
7 URL url = UtilTools.class.getResource("");
8 File file = new File(url.getFile());
9 String path = file.getParent();
10while(-1 != http://www.doczj.com/doc/ce64b1f4b14e852458fb57d3.htmlstIndexOf("bin") || -1 != http://www.doczj.com/doc/ce64b1f4b14e852458fb57d3.htmlstIndexOf(".jar"))
11 {
12 file = new File(path);
13 path = file.getParent();
14 }
15if (path.startsWith("file"))
16 {
17 path = path.replaceAll("file:", "");
18 }
19 path = path + File.separator+"JmailConfig.xml"
20return path;
21 }