java工程文件路径的问题

String classpath = this.getClass().getResource("/").getPath().replaceFirst("/WEB-INF/classes/", "").replaceFirst("/", "");

String filePath=classpath+"/data/custNmList.xml";

D:/rw_pro_mars32/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/rwsN/src/main/webapp/data/custNmList.xml

原文

http://www.cnblogs.com/a757956132/p/4744675.html

好像properties文件必须放在根目录下,不然获取不到,然而springmvc的log4j.properties也没有放在根目录下

原文地址:https://www.cnblogs.com/Baronboy/p/7481833.html