JSP获取绝对物理地址

session.getServletContext().getRealPath("");

但是 getRealPath("a"+File.separator);出来的结果是没有最后一个File.separator的;

getRealPath方法给去掉了;如果需要增加最后一个File.separator,自己得到路径之后

再增加:path = path + File.separator;

原文地址:https://www.cnblogs.com/stono/p/4781242.html