问题
I'm having some troubles to load images in javaFX from the controller.
I put some images in the src/ folder and even in a folder img/ but still getting "Invalid URL or resource not found".
My directory is like
src/
package/
javaFXcontroller.java
img/
image.png
So I'm doing Image img = new Image("./img/image.png");
But I can't retrieve the image "java.lang.IllegalArgumentException: Invalid URL or resource not found"
Thanks for your help
回答1:
For those who may encounter the same problem, just drag your images into the src/ folder directly with eclipse and then require your image with the path new Image("image.png").
来源:https://stackoverflow.com/questions/53952266/cant-load-javafx-image