title: Java: Accessing properties file inside a war
body: <p>I already searched StackOverflow for &quot;properties inside war&quot;, but none of the results worked for my case.</p>
  <p>I am using Eclipse Galileo and GlassFish v3 to develop a set of web services.  I am using a &quot;dynamic web project&quot; with the following structure</p>
  <pre><code>Src
  -java_code_pkg_1
  -java_code_pkg_2
  -com.company.config
  --configfile.properties WebContent
  -META-INF
  -WEB-INF
  --log4jProperties
  --web.xml
  --applicationContext.xml
  --app-servlet.xml
  </code></pre>
  <p>I want to access the &quot;configfile.properties&quot; inside one of the source files in &quot;java_code_pkg1&quot;.  I am using the Spring Framework and this file will be instantiated once the application starts on the server.</p>
  <p>I have tried the following with no luck</p>
  <pre><code>getResourceAsStream(&quot;/com.company.config/configfile.properties&quot;);
  getResourceAsStream(&quot;/com/company/config/configfile.properties&quot;);
  getResourceAsStream(&quot;com/company/config/configfile.properties&quot;);
  getResourceAsStream(&quot;/configfile.properties&quot;);
  getResourceAsStream(&quot;configfile.properties&quot;);
  
  getResourceBundle(..) didn't work either.
  </code></pre>
  <p>Is it possible to access a file when it's not under the <code>WEB-INF/classes</code> path? if so then how?</p>