I'm writing a dynamic web module using Tomcat 7 with Eclipse and Java 8, and my problem is that a required JAVA project on the build path is using the following to load files (lexicons, dictionaries, etc):
String filePath = "conf/test.txt"; // my test file is in WEB-INF/conf
String absolutePath = ClassLoader.getSystemResource(filePath).getPath();
I'm getting a null pointer so it's not finding the file.
When using the following, it finds the file:
String absolutePath = new File(filePath).getAbsolutePath();
The problem is:
I am required to use ClassLoader.getSystemResource. How can I specify my file's path for it to work without getting a null pointer (without using absolute paths too)?