Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

OutputStreamPath

Daniel Chacón Sánchez

2007-03-01

Replies:

Hi all

I have a question, how I can set the path for the OutputStream like i get it
for the InputStream with getResourceAsStream?

This is my code:


          Properties properties = new Properties();
          String pathToConfigurationFile =
"common/properties/Configuracion.properties";
          InputStream input =
            Thread.currentThread
().getContextClassLoader().getResourceAsStream(pathToConfigurationFile);

          //Load the properties
          properties.load(input);
          input.close();

          //Set the property datasource
          properties.setProperty("datasource", datasource);

          //Now I want to save the changes to the properties file

          OutputStream out= new FileOutputStream(
pathToConfigurationFile);
          properties.store(out, "");

        //But an exception occurs and it tells me that the
"common/properties/Configuracion.properties" was not found.

How I can get the correct path for the outputStream like i did with the
inputStream

Thanks!!
©2008 junlu.com - Jax Systems, LLC, U.S.A.