I will briefly describe the situation; the ContextListenner class implements the ServletContextListener to call methods from the ConnectionManager class before initializing the context. The ConnectionManager class is used to create a pool of connections for a database. To initialize the pool, I want to use the properties file. To read from the file wrote the following method:
public static String getValue(String key) { try (BufferedReader br = new BufferedReader( new FileReader(new File("D:/Java/Projects/Dictionary/properties/dictionaries.properties")))) { Properties p = new Properties(); p.load(br); return p.getProperty(key); } catch (IOException e) { return null; } } To search for a file, I specify an absolute URL, but I understand that this is not correct. I have a project in one folder, eclipse in another folder, but when I specify a relative address in a method, it searches in the eclipse folder, and not in the project folder. What to do?
