tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Tomcat Wiki] Update of "HowTo" by hotmaz
Date Sat, 15 May 2010 19:02:22 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Tomcat Wiki" for change notification.

The "HowTo" page has been changed by hotmaz.
http://wiki.apache.org/tomcat/HowTo?action=diff&rev1=90&rev2=91

--------------------------------------------------

            // assuming you want to load application.properties located in WEB-INF/classes/conf/
            String propFile = "conf/application.properties";
            java.net.URL url = loader.getResource(propFile);
- 	  try{prop.load(url.openStream());}catch(Exception e){Syste,.err.println("Could not load
configuration file: " + propFile);}
+ 	  try{prop.load(url.openStream());}catch(Exception e){System.err.println("Could not load
configuration file: " + propFile);}
       }
  
       //....
@@ -50, +50 @@

    }
  }}}
  
- This method even works in a standalone java application. So it is my preferred way.
+ This method even works in a standalone java application. So it is my preferred way. (see
also [[http://knowhow.amazers.net/space/dev/java+tips/Loading+properties+in+a+web+application|this
article]])
  
   * Use a `ResourceBundle`. See the Java docs for the specifics of how the `ResourceBundle`
class works. Using this method, the properties file must go into the `WEB-INF/classes` directory
or in a jar file contained in the `WEB-INF/lib` directory.
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message