java 文件读取的一些方法

web项目读取日志文件

     //得到路径
String appPath = filterConfig.getServletContext().getRealPath("/"); // 获取downLoadLog.txt文件 File logFile = new File(appPath, "downloadLog.txt"); if (!logFile.exists()) { try { logFile.createNewFile(); } catch (IOException e) { e.printStackTrace(); } }

 

posted @ 2019-01-28 20:35  江期玉  阅读(163)  评论(0编辑  收藏  举报