I encountered a problem with getPath() recently.
my code looks something like this:
File path = new File(Main.class.getResource("/worlds/").getPath());
File[] files = path.listFiles();
The Problem now is, that if there is a space somewhere in the Path to the Main class, path.listFiles() will return null. If there is no Space, everything works fine.
if i print the path to the cmd, i see that every space is replaced by an %20
Don’t do that. A resource URL returned by getResource() isn’t necessarily a file on the file system, which is what File represents.