java获取resource下目录及获取tomcat工作目录
- 获取resource下static路径
String path = this.getClass().getClassLoader().getResource("static").getPath();
- 获取webapp路径
String path = ServletContextFactory.getServletContext().getRealPath("/");
String path = this.getClass().getClassLoader().getResource("static").getPath();
String path = ServletContextFactory.getServletContext().getRealPath("/");