Java J2ME JSP J2EE Servlet Android

JAVA: Accessing properties file(resource) inside jar

You can not load a properties file inside a jar as following way..


Properties props = new Properties();
props.load(new FileInputStream("conf.properties"));


In this case you have to use

Properties props = new Properties();
InputStream in = this.getClass().getClassLoader().getResourceAsStream("conf.properties");
props.load(in);


I hope this will help you. For any other query you can post question as comment.