Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Loading properties file  RSS feed

 
Garandi Garandi
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a properties file that I want to load into my program. it is in the same dir as my main(), but I get FileNotFoundException.



Thank you in advance
Garandi
[ August 03, 2004: Message edited by: Garandi Garandi ]
 
David Weitzman
Ranch Hand
Posts: 1365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
new FileInputStream("blah") will look for a file named "blah" in the directory where you start the JVM. If blah is mixed in with the classfiles in the same directory as the class that wants to read it, you can say getClass().getResourceAsStream("blah") instead.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!