I have a class,in which ther is a func,which opens a properties file. When i write main in the same class & call that function,i am able to open the properties file n read. but, when i am tying to call the same func in my servlet by creating instance to that class, i get file not found exception.
This is the function, which i have written in my class to read properties file. And both my class and servlet are in src folder. I am using eclipse IDE.
Code:
private void readPropertiesFileAndFieldListData() { String PROP_FILE = "./src/fields.properties"; try { FileReader reader = new FileReader(PROP_FILE); BufferedReader br = new BufferedReader(reader); ArrayList<String> field = new ArrayList<String>(); while ((str = br.readLine()) != null) { if (!str.startsWith("#") && str.trim().length() > 0) { // System.out.println(str); field.add(str); count++; } } }