This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
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

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
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:
subject: Property files in java