Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Acessing .properties file after loading into db as JAVA RESOURCE

Re: Acessing .properties file after loading into db as JAVA RESOURCE

From: Maury Jarrell <mj_at_mauryjarrell.com>
Date: 25 Apr 2003 09:19:31 -0700
Message-ID: <67c512fc.0304250819.461e58d2@posting.google.com>


mj_at_mauryjarrell.com (Maury Jarrell) wrote in message news:<67c512fc.0304240629.185b86b_at_posting.google.com>...
> FileInputStream fin = new FileInputStream( "Hola.properties" );
> Properties hola = new Properties();
> hola.load(fin);

Got the answer from Oracle's Metalink and thought I'd post it here. It was more my Java ignorance than my Oracle ignorance.

Instead of the above, you can do:

hola.load(TestProps.class.getResourceAsStream("Hola.properties"));

This delegates to class loader and searches your classpath for that resource. It works inside and outside of Oracle. ( With no slash in front it pre-pends the package to the resource name... check the javadocs for details )

HTH Somebody,
Maury Received on Fri Apr 25 2003 - 11:19:31 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US