servlet程序打成一个war,war名叫'test.war',我想访问test.war包中的setting.properties文件,那应该写的相对路径是什么?为什么我怎么写都不对?(写绝对路径是OK的)
test.war的目录结构为:
WEB-INF
classes
lib
setting.properties
web.xml
FileInputStream is = new FileInputStream("/test/WEB-INF/setting.properties");//不行
FileInputStream is = new FileInputStream("/WEB-INF/setting.properties");//不行
FileInputStream is = new FileInputStream("setting.properties");//不行
FileInputStream is = new FileInputStream("D:\\workspace\\test\\WebContent\\WEB-INF\\setting.properties"); //Ok
慕斯王
呼如林
相关分类