1

For my current project (Better Checks - a small argument validation library), I am trying to figure out where (in the classpath) the applications using the library should put the configuration file. It is a .properties file with customized error message formats.

Is there a standard or de facto standard location for library config files?

My current take is /better-checks.properties. I am a bit worried that this is not a good idea, since it is directly in the root of the classpath and might theoretically collide with some other file.

An alternative would be to put it into the root package of the library, /ch/trick17/betterchecks/config.properties which would prevent name collisions but seems a bit weird.

Edit: Take into account that if I want to support internationalization by using resource bundles, applications might end up with many better-checks_*.properties in the classpath root. This is not very nice, is it?

rolve
  • 10,083
  • 4
  • 55
  • 75

2 Answers2

0

You're worried about a problem that is unlikely. I agree - it is weird. As long as it's in the CLASSPATH you won't have a problem.

duffymo
  • 305,152
  • 44
  • 369
  • 561
0

Majority of the applications choose putting config files in the classpath as you have done.

Some of the frameworks put some of their config file inside META-INF directory. For e.g., EJB3 persistence config file defaults to META-INF/persistence.xml

However its debatable whether this is a good practise or not. See here for a good discussion and decide for yourself.

Community
  • 1
  • 1
Shailendra
  • 8,874
  • 2
  • 28
  • 37