• Post Reply Bookmark Topic Watch Topic
  • New Topic

Reading from a config file  RSS feed

 
George Bock
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,

I am a C++ programmer but a newby to Java, so I would appreciate if anyone could help me with the following simple situiation.

I have a config file, which stores usernames together with hashed passwords, for example: user1, hash1; user2,hash2;

* How can I retrieve these values from my Java application ?

Can anybody provide me links to some tutorials or documentation which will help me accomplish abovewritten ?

Thanks in advance.
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use FileInputStream and File as parameter to its constructor.File object would point to the exact config file in your filesystem.

Property files are heavily used in java for config related purposes.As they have a neat interface for extracting values of various keys from the file.

You can get api docs of FileInputStream , File from javadoc of the version of JDK you are using.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!