For Programmers: Free Programming Magazines  


Home > Archive > Java Help > January 2006 > property file problems









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author property file problems
sarath

2006-01-27, 3:59 am

I am trying to read a property file.. using the code,

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

this property file is in the same package as my source file... still it
gives me FileNotFoundException.

i have tried giving ./SessionInit.properties and different other
options.. but still gives the trouble.. i am using jkd 1.5 and netbeans
IDE v 5.0



thanks in advance.
sarath

Tony Morris

2006-01-27, 3:59 am

"sarath" <sarath.post@gmail.com> wrote in message
news:1138342537.065871.27510@g47g2000cwa.googlegroups.com...
> I am trying to read a property file.. using the code,
>
> properties.load(new FileInputStream("SessionInit.properties"));
>
> this property file is in the same package as my source file... still it
> gives me FileNotFoundException.
>
> i have tried giving ./SessionInit.properties and different other
> options.. but still gives the trouble.. i am using jkd 1.5 and netbeans
> IDE v 5.0
>
>
>
> thanks in advance.
> sarath
>


The file needs to be relative to System.getProperty("user.dir").
Also, your code will leak the file resource if you do not maintain a
reference and call close() in a finally block.

--
Tony Morris
http://tmorris.net/


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com