static{ String path = new Object(){ public String getPath() { return this.getClass().getResource("/../../").getPath(); } }.getPath();
//path: ../项目名/ String fullPath = path + "data/"; }
java 方法内:
String baseUrl = System.getProperty("catalina.home");
//baseUrl ../tomcat/ String fullPath = baseUrl + "/webapps/cfservice/data/..";