I want to upload a picture to a form in a JavaFX application. Now I do it as follows:
ImageView imageView1 = new ImageView("file:/hourglass.jpg"); The problem is that the picture is taken directly from the root of the D drive. I also need to set the path relative to my Java program. Construction, type:
ImageView imageView2 = new ImageView("/img/ilovedogs.jpg"); does not work. Writes this:
Caused by: java.lang.IllegalArgumentException: Invalid URL: Invalid URL or resource not found
How to configure everything and where to create the img folder?
img/ilovedogs.jpgor./img/ilovedogs.jpgor all the same with the addition offile:frontfile:./img/ilovedogs.jpg- Sergey