Accessing my file under src/main/resources

1.11.2 Platform Version: 2.2 OpenMRS Version:

Hello experts,

I am writing a custom module. I have stored a .csv file under src/main/resources/myfolder/myfile.csv which I need to read in my module.

I have helper class that would like to access this .csv file. I am not sure how can I go about accessing this file for reading. I tried ClassLoader.getSystemResourceAsStream("myfolder/myfile.csv");

This doesn’t work. the call returns null.

Can you please suggest how I can access the file to read.

Do OpenmrsClassLoader.getInstance().getResourceAsStream("file.csv")

Thanks Daniel for your quick response. I will try and if it works I will click solved.