jQuery in Action, 3rd edition
The moose likes Beginning Java and the fly likes Property files in java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Property files in java" Watch "Property files in java" New topic

Property files in java

Uma Reddy

Joined: Apr 16, 2010
Posts: 4
How does java know to load the correct property file. We have development, integration and acceptance environments. How does java pick the right property file corresponding to each environment. I will appreciate if someone can explain clearly how java does it. Thank You, Uma
Satya Sakhinetipalli

Joined: May 16, 2008
Posts: 7
Define an environment variable some value (tier name can be the value) and respective properties file is loaded for that tier. ex :

-DCONFIG_MODE=dev in development and properties file related to dev is loaded.

David Newton

Joined: Sep 29, 2008
Posts: 12617

Java has no default mechanism for doing this. As Satya implies, there must be some way of defining which file to load. There are, however, a whole bunch of ways this could be implemented.
I agree. Here's the link: http://aspose.com/file-tools
subject: Property files in java
It's not a secret anymore!