Im using IntelliJ if this is relevant.
Im trying to open a folder(from a different package) as a file in order to get a list of all the files in the folder.
Here is the structure of my program: (both the wanted folder and the class where the code is written are highlighted)
Here is the code where I try to open the folder as a File:
...
File emoteFolder = new File(getClass().getClassLoader().getResource("TwitchBotStadium/htmlFormater/emotes").getFile());
...
The problem is that emoteFolder is null, no matter what I put in the brackets of new File() nothing worked. I've tried:
File emoteFolder = new File(getClass().getResource("/TwitchBotStadium/htmlFormater/emotes").getFile());
File emoteFolder = new File("/TwitchBotStadium/htmlFormater/emotes");
File emoteFolder = new File("TwitchBotStadium/htmlFormater/emotes");
File emoteFolder = new File(HtmlMessageFormater.class.getResource("emotes/").getPath());
etc...
I've searched for a solution but couldn't find anything, I'm really close to just restructure the project but I still have some hope to find some help here.