title: Storing changes in .properties file that has been read via getClass().getResourceAsStream
body: <p>I am writing a java web application that reads properties from a .properties file. Since I do not know the absolute path of the .properties file, because it depends on the environment the application will run on in the future, I have to load it with "getClass().getResourceAsStream":</p>
  
  <pre><code>Properties props = new Properties();
  props.load(getClass().getResourceAsStream("test.properties"));
  message = props.getProperty("testdata");
  </code></pre>
  
  <p>This works as expected. Now I want to change the value for testdata in the file. But I cannot open an Outputstream to write to, because I still don't know the path of the .properties file.</p>
  
  <pre><code>props.setProperty("testdata", "foooo");
  props.store(new FileOutputStream("?????"), null);
  </code></pre>
  
  <p>Is there a way to get the path of the file or can I use the established Properties-object somehow? Any ideas are welcome that allow me to change the .properties file.</p>