I am trying to avoid using SceneBuilder to load an image to a scene. In SceneBuilder, I made a spot for the ImageView, and I assigned it an fx id, then declared that fx id as "icon" and did the same for the controller class I would like to call the ImageView/image from the controller class. I have tried
@FXML
ImageView icon;
Image image = new Image("../basketball.jpg");
icon.setImage(image);
I don't know what the solution would be for this, so is there a simple way to do this without SceneBuilder browsing for the image directly? My .jpg file is at the top of my project, not in a specific folder. I thought it would be simple since I have the .jpg file included in my eclipse project.