I have a question which is not answered by this question (I believe). I have two separate maven projects and in one of them I want to go through all files (they happen to be .txt files) inside a certain directory. This directory lies inside the resource folder of my first maven project. Then I want to export my first maven project and import it in to SceneBuilder as a .jar and still have the importing of .txt files working. When this is done I want to use this .jar as a custom component inside my second maven project.
For some clarification here is the exact setup in my case. Here is the directory of my first maven project:
From a .java file called GradientPicker
inside of com.thefractory.customcomponents
I want to loop through the gradients
folder seen above and want to read all .txt files in it. There will be a different number of files each time so an enhanced for-loop would be nice. This part I have actually managed to do but only when GradientPicker
is run from Eclipse. I want this to work when my project is run as a .jar as well.
How do I loop through a directory and read all files from within a .jar?