获取项目路径


 获取项目路径
1.this.getClass().getClassLoader().getResource("/").getPath();
 getClass().getProtectionDomain().getCodeSource().getLocation().getPath();
 2.req.getSession().getServletContext().getRealPath("/resources/upload");
 3.servletContext.getRealPath("/").substring(0, servletContext.getRealPath("/").lastIndexOf("seawin-webapp-base"))

原文地址:https://www.cnblogs.com/jbml-154312/p/7692846.html