Possible to find out the path of the resource?

L

laredotornado

Hi,

I'm using the below code to get properties from a Properties file ...

java.util.Properties props = new java.util.Properties();
ClassLoader cl = this.getClass().getClassLoader();
InputStream input = cl.getResourceAsStream( "mine.properties" );
if (input == null) {
out.println("can't find properties.");
} else {
props.load(input);
out.println(props);
} // if

My question is, is it possible to find out the path of
"mine.properties" if it is located? I'm using Java 1.5 on Weblogic
9.2.2.

Thanks, - Dave
 
S

softwarepearls_com

ClassLoader also has getResource() which returns a URL. Via that
route, you can find the path of the file.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,740
Latest member
JudsonFrie

Latest Threads

Top