• Post Reply Bookmark Topic Watch Topic
  • New Topic

configuration file  RSS feed

 
ritwik roy
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hai all
it will be very much helpful for me if someone can provide me some knowledge regarding (or some useful links) how to write a configuration file in java. what should be in it and how an application can access and use it.
thanking in advance
 
Joe Ess
Bartender
Posts: 9442
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Depends on what you are trying to do. Simple configuration tasks can be accomplished with java.util.Properties. For more complex needs you may want to use the java.util.prefs functionality (here is an article discussing the shortcomings of properties files and the use of prefs).
Making a configuration object and persisting it with Object Serialization is another option. All depends on your requirements.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Another way would be an XML file, which can be used for structured data (which is tricky to do with properties files). Something like Jakarta Commons Digester can make the binding of XML-stored configuration information to Java objects easier.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!