I have a resources folder/package in the root of my project. All I want to do is to load a "Folder" within the resources folder, loop through the Files inside that Folder and get a Stream to each file and read the content from each file. https://i.stack.imgur.com/aAev6.jpg
I've tried doing this in several different ways and most of them work in the IDE but not when I launch my application from the jar file directly.
For example this code works fine in the IDE :
String data ="/fichier/";
public ArrayList<String> getResources(final String path) throws IOException {
ArrayList<String> retour = new ArrayList<>();
String Line;
final InputStream is = getClass().getResourceAsStream(path);
final InputStreamReader isr = new InputStreamReader(is, StandardCharsets.UTF_8);
final BufferedReader br = new BufferedReader(isr);
while ((Line = br.readLine()) != null) {
retour.add(Line);
}
return retour;
}