tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <Jacob.R.Kj...@syntegra.com>
Subject RE: loading a properties file - where does it expect the file tobe?
Date Wed, 11 Oct 2000 18:46:49 GMT
I use the following code to load a properties file:

Properties props = new Properties();
try {
    	InputStream propsStream =
this.getClass().getResourceAsStream("my.properties");
    	if (propsStream != null) {
    		props.load(propsStream);
				propsStream.close();
			}
    } catch (IOException e) {
    	System.err.println("Caught IOException: " + e.getMessage());
		}

This loads the properties file as long as the properties file is in the same
relative position as the calling class whether that be in a physical
directory or a jar file.


Jake

-----Original Message-----
From: Daniel Barclay [mailto:Daniel.Barclay@digitalfocus.com]
Sent: Wednesday, October 11, 2000 1:23 PM
To: tomcat-user@jakarta.apache.org
Subject: Re: loading a properties file - where does it expect the file
tobe?


Raimee wrote:
> 
> Have you considered the System Properties Class?

Try ResourceBundle.



-- 
Daniel Barclay
Digital Focus
Daniel.Barclay@digitalfocus.com

Mime
View raw message