jeudi 20 octobre 2016

properties file in Web project

I have all my programming code packaged in a jar file. This Jar file i will be placing in my dynamic web project to execute the logic in a jar.

But jar file has some logic which reads a .properties file to get some configuration values.

When i run my web project for the logic i get a error java.io.FileNotFoundException: conf\conf.properties (The system cannot find the path specified)

WebContent
|__WEB-INF
|___conf
|____conf.properties
|___lib
|_____myJar.jar

I have following code for reading the properties file.

String propFileName = "conf/conf.properties"; 
Properties prop = new Properties();
prop.load(getClass().getResourceAsStream(propFileName));

Any suggestion to resolve this issue plz.




Aucun commentaire:

Enregistrer un commentaire