标签:
String base_Url = request.getSession().getServletContext().getRealPath("/"); String windows_path = "js\\weixin\\wxMenuTemplate.json"; String linux_path = "js/weixin/wxMenuTemplate.json"; String osName = System.getProperties().getProperty("os.name"); String url = base_Url + (osName.equals("Window") ? windows_path : linux_path); log.info("=============generateMenu=====wxMenuTemplate.json url=================: "+url); //String tempUrl = "/home/application/tomcat11002-website/webapps/ROOT/js/weixin/wxMenuTemplate.json"; String jsonStr=FileUtil.read(url,"UTF-8");
javaweb工程,Servlet里面获取当前WEB跟路径的文件绝对路径地址
标签:
原文地址:http://www.cnblogs.com/fhtwins/p/4288214.html