Using Spring Boot. I am trying to parse an excel file stored locally within the project using Apache POI library. My directory structure is like so:
src
main
java
- com.app
- controllers
- models
- repositories <- I am calling from here
- com.app
resources
- static
- Test.xlsx <- I'm trying to access this
- static
File excel = new ClassPathResource("Test.xlsx").getFile();
File file = new File(classLoader.getResource("src/main/resources/static/test.xlsx").getFile());
I have tried both of the above ways to access the file, and I have tried many variations of paths to the file, but nothing has worked. I do not get build errors or runtime errors, the file is simply not found and when I attempt to invoke the method I get a NullPointerException on that line.