tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From José Moreira <jmore...@e-terno.net>
Subject RE: Properties file [SOLVED?]
Date Wed, 26 Feb 2003 16:31:23 GMT
still didnt work ...

my code :\

String path =
this.getClass().getClassLoader().getResource("config.properties").getPath().
toString();

FileInputStream in = new FileInputStream(path);

properties.load(in);



-----Mensagem original-----
De: Jacob Kjome [mailto:hoju@visi.com]
Enviada: quarta-feira, 26 de Fevereiro de 2003 15:35
Para: Tomcat Users List
Assunto: Re: Properties file [SOLVED?]



Why don't you just load the properties file as an inputstream.  If you get
the path and then use that for a File object, you are making your webapp
non-portable.  If your webapp is served directly from a .war file, you
won't have the ability do perform File IO.  Use streams and URL's and you
will be fine.

Jake

At 03:24 PM 2/26/2003 +0000, you wrote:
>i copied the 'config.properties' file to WEB-INF\classes and accessed it
>from inside a bean using
>
>
>this.getClass().getClassLoader().getResource("config.properties").getPath()
.
>toString()
>
>ang got
>
>         N:/webapps/Java/Project/WEB-INF/classes/config.properties
>
>i hope the is no downside to this
>
>cheers
>
>good work
>
>
>---------------<*>----------------------
>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



---------------------------------------------------------------------
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