I use afterburner.fx DI in my project. All things works fine, except when I try to load a file into a object injected from resources folder.
I try putting getClass().getResource()
, Class_name.class.getResource
... but seems not to be work.
For example, I try to load image to use as icon for app, so I try with (other method that's not works):
getIcons().add(new Image(Thread.currentThread().getContextClassLoader().getResourceAsStream("/img/logo.png")));
All ways return same error:
java.lang.NullPointerException: Input stream must not be null
Finally, I found the problem that no have relation with Afterburner.fx:
When I create Project with maven, I not include resources from folder img in my POM, so I get always the above error. Perhaps, I can load other default resources like css styles.
After configure correctly my POM, all things work.