Why wouldnt :
Properties properties = new Properties();
InputStream stream = context.getResourceAsStream("config.properties");

properties.load(stream);


work?

Why create the new stream object when its there for the taking?




Jos� Moreira wrote:
my code:

Properties properties = new Properties();

        String path =
getClass().getClassLoader().getResource("config.properties").getPath().toStr
ing();

try {

FileInputStream file = new FileInputStream(path);

properties.load(file);

} catch (FileNotFoundException f) {

this.status = "nao abriu :"+path;

} catch (IOException e) {

this.status = path+" IOException";

} catch (NullPointerException n) {

this.status = path+" NullPointerException";

}

this.status = properties.getProperty("database");



---------------<*>----------------------
Jos� Moreira

T�cnico de Inform�tica | IT Technician

Vila Nova de Gaia, Portugal

E-Mail: [EMAIL PROTECTED]

MSN: [EMAIL PROTECTED]

ICQ: 136936120

IRC: ethernal (irc.ptnet.org)



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to