Java: Accessing properties file inside a war

后端 未结 6 1464
花落未央
花落未央 2020-12-06 06:29

I already searched StackOverflow for \"properties inside war\", but none of the results worked for my case.

I am using Eclipse Galileo and GlassFish v3 to develop a

6条回答
  •  天命终不由人
    2020-12-06 07:11

    Check the location of the properties file in WAR file. If it is in WEB-INF/classes directory under com/company/config directory getResourceAsStream("com/company/config/configfile.properties") should work or getResourceAsStream(" This should work if the config file is not under WEB-INF/classes directoy

    Also try using getClass().getClassLoader().getResourceAsStream.

提交回复
热议问题