I am trying to load a text-csv file which is bundled with my module. It is located under src/main/resources and when the module is compiled, the file is located in the root directory of the created omod. I am using FIleInputStream to load the file, but I always get a file not found exception. I tried various paths like ‘/test.csv’, /src/main/resources/test.csv etc. What is the correct path specification in the context of the module structure?
You would not likely want to use a FileInputStream
for this, but rather load from the classpath directly. You’ll want something like:
OpenmrsClassLoader.getInstance().getResourceAsStream("test.csv")
2 Likes
Thanks Mike, it’s working now