• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Loading Properties file

 
morteza av
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I write tow method for my class to obtain correct file path in FileInputStream class to loading Properties file:

and use:

Its work in netbeans IDE correctly, but when I compile my class the .properties file miss in dist folder. It don’t work even I paste .properties file inside my app folder.
Can you help me?

 
Chinna Eranna
Ranch Hand
Posts: 174
Java
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where does setting.properties file exist ?

inside some package(of class directory) ?
 
Wouter Oet
Saloon Keeper
Posts: 2700
IntelliJ IDE Opera
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Small hint for the method getClassName(): look at the method Class.getSimpleName()
 
morteza av
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chinna Eranna wrote:Where does setting.properties file exist ?

inside some package(of class directory) ?

setting.properties exist in class directory.
 
Chinna Eranna
Ranch Hand
Posts: 174
Java
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe you don't need to do all the stuff you are doing.

Just use as shown



Remember the argument to getResourceAsStream(), should include the packages path if the properties file is under any java package.

For ex, if it is under com/xyz/setting.properties, then the argument should be "/com/xyz/setting.properties".
 
Vijitha Kumara
Bartender
Posts: 3909
9
Chrome Fedora Hibernate
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to the Ranch, Morteza Av!
 
morteza av
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks all friends.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic