One year ago I've wrote JavaFX 2.0 application for my graduation work. But after one year pass I have a problem with code, that worked before.
So, in code I want to get folder and list it's files:
File dir = new File(getClass().getResource("media/images/backgrounds/").getPath());
File[] files = dir.listFiles();
for (File file : files) {
list.add(file.toURI().toString());
}
and I'm getting java.lang.NullPointerException on line "for (File file : files) {"
System.out.print(getClass().getResource("media/images/backgrounds/").getPath());
returns file:/D:/JavafxApp1/JavafxApp/dist/run2054723721/JavafxApp.jar!/javafxapp/media/images/backgrounds/
I don't want make another method for reading files from stream from JAR file.This method of getting files have worked 100% one year ago, but why it doesn't work now? Thanks!