java 得到目录路径的方法
时间:2019-04-06 19:50:35
收藏:0
阅读:118
得到web项目的根目录路径
System.getProperty("user.dir")//
String path = this.getServletContext().getRealPath("/WEB-INF/order_form.html");
得到类所在的路径
FormServlet.class.getClassLoader().getResourceAsStream("FileName");//可以直接读取文件
原文:https://www.cnblogs.com/jiangfeilong/p/10662447.html
评论(0)