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 EJB and other Java EE Technologies and the fly likes [Urgent]Accessing properties file 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 » EJB and other Java EE Technologies
Bookmark "[Urgent]Accessing properties file " Watch "[Urgent]Accessing properties file " New topic
Author

[Urgent]Accessing properties file

Sukh sri
Greenhorn

Joined: Mar 25, 2008
Posts: 3
We have a requirment where we need to access the properties file from various J2EE modules like war , rar , ejb-jar . These modules can modify the properies file. And the modification should be availbale to other modules ....

What will be the good option.
Sukh sri
Greenhorn

Joined: Mar 25, 2008
Posts: 3
Why there were no replies .... is there something missing from the details...

... we came through different approaches like

Using properties file , resource bundle etc .. but , our requirement is that the properties file should be writable
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41599
    
  55
I'm sorry, but you have to be kidding to expect an answer in 30 minutes: PatienceIsAVirtue. You might also usefully read EaseUp and the other tips we have on getting the most out of the Saloon: HowToAskQuestionsOnJavaRanch.


Ping & DNS - my free Android networking tools app
Roger Chung-Wee
Ranch Hand

Joined: Sep 29, 2002
Posts: 1683
An updated properties file is usually available after the application has been redeployed or the server restarted. Consider writing to a database instead.


SCJP 1.4, SCWCD 1.3, SCBCD 1.3
Sukh sri
Greenhorn

Joined: Mar 25, 2008
Posts: 3
Hi Roger ,

thanks for your reply . But , the information that will go into the property file is about "ports" which does not look good to put them in the database. And also , this config file is to be shared between rar and war files .
Roger Chung-Wee
Ranch Hand

Joined: Sep 29, 2002
Posts: 1683
I don't see why port data cannot be written to a DB.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10067
    
163

Originally posted by Sukh sri:
But , the information that will go into the property file is about "ports" which does not look good to put them in the database.


In addition to what Roger mentioned, property files are in most cases changed during deployment and not dynamically. I second with what Roger mentioned about using database for storing/sharing this information. However, if you are still reluctant in doing this, you can think of having a single common service which will be used by these war,rar etc... to modify/access the properties. Doing this will ensure that the common service is aware of any changes to the properties and will be able to return this changed property.


[My Blog] [JavaRanch Journal]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: [Urgent]Accessing properties file