,如果你把它放在你可以加載這樣的WEB-INF/classes中:
InputStream is = this.getClass().getClassLoader().getResourceAsStream("/client.properties");
同樣,你可以做
InputStream is = this.getServletContext().getResourceAsStream("/WEB-INF/client.properties");
然後:
Properties props = new Properties();
props.load(is);
String whatever = props.getProperty("whatever_key");
每docs https://developers.google.com/appengine/docs/java/?hl=en-US#The_Sandbox:
任何戰爭應該是默認的工作:
請在AppEngine上-web.xml中確保你沒有任何除外):
<resource-files>
<exclude path="**.properties"/> ...make sure you haven't done this
</resource-files>
任何戰爭應該是默認的工作工作得這麼嘗試閱讀從/config/client.properties
java.io.FileReader肯定會。
或
InputStream is = this.getServletContext().getResourceAsStream("/config/client.properties");
我沒有把它放在WEB-INF,如何從它在戰爭文件夾中的文件夾外部加載? –
戰爭之下的任何東西都應該是一種資源,除非你排除它。嘗試/config/client.properties – user1258245