cancel
Showing results for 
Search instead for 
Did you mean: 

Loading properties file

Former Member
0 Kudos

Hi,

Im trying to load a properties file which i put under my project/conf/my.properties. I tried to load it using:


FileInputStream fis = new FileInputStream(new java.io.File( "conf\ewl.properties"));

but this result in a file not found. Can anyone tell me how i can load the properties file.

Much thanks,

Hugo

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hugo,

Place the file under "src" folder, say to path src/com/company/app/config

Now you can get properties via:


final Properties myProps = new Properties();
myProps.load(
  this.getClass().getClassLoader()
    .getResourceAsStream("com/company/app/config/ewl.properties")
);

Valery Silaev

EPAM Systems

http://www.NetWeaverTeam.com

Former Member
0 Kudos

Thanks Valery,

worked like a charm.

grtz

Hugo

Answers (1)

Answers (1)

BeGanz
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Hugo,

to load a properties file which is deployed with your Web Dynpro project you can apply the <b>WDResourceHandler </b>service API.

Read the <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/4a417a90-0201-0010-f499-8d41fc78c837">Web Dynpro Quiz Tutorial</a>, pages 40-42:

Regards, Bertram