Java或Web工程中查找配置文件

String path = "";
URL url = Thread.currentThread().getContextClassLoader().getResource("/");
if(url != null)
      path = url.getPath();
else
      path = System.class.getResource("/").getPath();
path = path + "/sso-config.properties";
System.out.println(path);

你可能感兴趣的:(Java或Web工程中查找配置文件)