| Author |
Properties file reading problem
|
mallikarjun dontamsetti
Ranch Hand
Joined: Mar 18, 2011
Posts: 177
|
|
Hi i have an wweb application the connection details for that application are written in a properties file and placed in the same package that my java program uses it and get the connection. But when i deploy it it is Tomcat log are saying that it can not find the connection.properties file why?
My code in getting connections in JAVA file is DBConn.java
|
 |
Koen Aerts
Ranch Hand
Joined: Feb 07, 2012
Posts: 339
|
|
|
You could also use the ResourceBundle class to open the properties file, and you don't need to specify the .properties extension. An example can be seen here: http://koenaerts.ca/websphere-global-properties-files/
|
 |
Roberto Perillo
Bartender
Joined: Dec 28, 2007
Posts: 2147
|
|
Koen Aerts wrote:You could also use the ResourceBundle class to open the properties file
I'd say it is better to use a ResourceBundle only for properties of the presentation layer (i.e. labels that are displayed in a web page), or resources that are locale-specific.
Mallikarjun, try the following:
|
Cheers, Bob "John Lennon" Perillo
SCJP, SCWCD, SCJD, SCBCD - Daileon: A Tool for Enabling Domain Annotations
|
 |
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 11863
|
|
Why substring(6)???
If I had a file reading problem I would certainly log or print to System.out the path I was trying to open.
Bill
|
Java Resources at www.wbrogden.com
|
 |
Roberto Perillo
Bartender
Joined: Dec 28, 2007
Posts: 2147
|
|
William Brogden wrote:If I had a file reading problem I would certainly log or print to System.out the path I was trying to open.
Agreed.
|
 |
 |
|
|
subject: Properties file reading problem
|
|
|