• Post Reply Bookmark Topic Watch Topic
  • New Topic

Servlets to Load properties file from server bin directory

 
Sheikkadar Mohamedsahib
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Team,

I am looking forward to code to load the properties file from server/bin directory in servlets. Please let me know how to load that ?.

I dont want to keep that properties inside of my .war file.

Thanks,
Sheik
 
Tim Holloway
Bartender
Posts: 18415
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't.

I recommend that you keep a default properties file in your WAR for reliability's sake, but the external properties file should not be placed inside the webapp server directory subtree. You may potentially interfere with the proper operation of the appserver (for example, if the server does a generic scan for properties file to configure itself). Plus you risk losing the file if someone upgrades the server and the server directory gets deleted/rewritten.

In Linux systems, the better place to put such a file would probably be either /usr/share, /etc or /usr/local/etc. Since these directories have a lot of stuff in them, a sub-directory specific to your webapp would be a good idea. Alternatively, if you deploy webapps to locations external to the webapp server (I often use /opt/com/mousetech/somewebapp/mywebapp.war), you might put the properties file in that location. /var/lib is occasionally used that way as well, especially if you have working files, such as a file upload directory (NEVER upload files into the WAR directory subtree!)

In Windows there is (even) less consistency, but the trend for such things is whatever the system "user" directory your current version of Windows is named for a basis.
 
Sheikkadar Mohamedsahib
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Tim. As I have placed my properties file inside war file !
 
E Armitage
Rancher
Posts: 989
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sheikkadar Mohamedsahib wrote:Thanks Tim. As I have placed my properties file inside war file !

What's going to happen when you want to change one of them?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!