tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: PROPERTIES files cannot be found?
Date Fri, 21 Nov 2003 03:12:14 GMT
> I have a properties file in my jar and put in under
> Tomcat/webapps/opencms/WEB-INF/lib/mystuff.jar
> Inside the jar the properties file is under /res/
> OpenCms is a servlet in tomcat, depoyed and working. I think this question is
> generally enough to be allowed to ask here in this forum.
> In my code I try to access the java property file with the following code:
> Properties p = new Properties();

You don't want to use a Properties object; you want to use a 
ResourceBundle. Using a FileInputStream won't work because it's in a JAR 
file, but the ResourceBundle looks in the classpath for the resource:

ResourceBundle bundle = ResourceBundle.getBundle("res/myconfig");

That should load your properties file from the JAR file.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message