tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From José Moreira <jmore...@e-terno.net>
Subject properties files
Date Tue, 25 Feb 2003 12:35:54 GMT
Hello, im using a propeties file to store and retrieve application settings
(like db conection) using this code :

    private Properties properties;

    private String status;

    private boolean NovoConfig;

    /** Creates new ConfigReaderBean */
    public ConfigReaderBean() {

        Properties properties = new  Properties();

        NovoConfig = false;

        try {

            properties.load(new FileInputStream("config.properties"));

        } catch (IOException e) {


            System.out.println("Erro ao ler config: "+e.getMessage());


            properties.setProperty("database.url","http://localhost/mysql");

            NovoConfig = true;

        }

        if (NovoConfig) {

            try {

                properties.store(new
FileOutputStream("newconfig.properties"),null);

                System.out.println("Criado: newconfig.properties");

            } catch (IOException e) {

                System.out.println("Erro ao criar novo config:
"+e.getMessage());

            }


        }

the problem is that it doesnt load the file and saves the
'newconfig.properties' file under the Netbeans IDE dir,

how can i load the file located under my webapp WEB-INF dir ?





---------------<*>----------------------
José Moreira

Técnico de Informática | IT Technician

Vila Nova de Gaia, Portugal

E-Mail: jmoreira@e-terno.net

MSN: jose_guedes@hotmail.com

ICQ: 136936120

IRC: ethernal (irc.ptnet.org)



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message