1 ServletContext context = this.getServletContext(); 2 String realpath =context.getRealPath("所需文件路径");
1 Properties p = new Properties(); 2 //获取字节码目录 3 String path=JdbcUtil.class.getClassLoader().getResource("db.properties").getPath();
原文:https://www.cnblogs.com/CptMac/p/12388825.html