IntelliJ not finding files clearly in the resources folder.
This isn't your usual "Can't access resources in my JAR" type of issue, because I understand how to do so using the getClass().getResource()
crap, but that's not what I'm here for.
I'm working in IntelliJ, and I've created a 'resources' directory inside the module, and marked it as a 'Resources Root'. My issue now, is that it is not located in my 'src' folder, which shouldn't be a problem to begin with, however I'm having trouble getting the directory of the resources folder. After compiling into a JAR file, I assume all files from the module are then built into the JAR file, including 'resources', 'src', and all files in 'resources'. The question now is, how can I access the 'resources' directory without using this getClass().getResource()
nonsense, which I've tried by the way, and access files within them?
This is my path:
-resources/fonts/font.ttf
-src/com/test/Class.java
Note that the resources and src directories are in the module, and the resources is marked as a resources root.
Please sign in to leave a comment.
What do you mean by 'access the resources directory'? Do you want to list all files under that directory? Or locate fonts/font.tff file?
And what is the problem with getClass().getResource() (which is the only way to access resources in Java in a location-independent manner)?