tomcat 和 weblogic获取项目的根路径的方法

web项目中tomcat weblogic都支持的写法 :

尝试用其他方法获取的时候 在linux下的weblogic会获取成空   

    String path = this.getClass().getClassLoader().getResource("/").getPath();

    String realPath = path.substring(0, path.length() - 17);

你可能感兴趣的:(javaweb)