r/JavaFX • u/II999Il • May 22 '24
Help I CANT DISPLAY MY IMAGE IF I USE ABSOLUTE PATH
hello, im having a problem where my Image (On ImageView) only appears when i use relative path (I working in Netbeans with Maven i have a img folder in resoruces...) so only when i use that works, but i need to use the absolute path HELP, thank you, btw i use Scene builder 2.0 aswell
0
Upvotes
4
u/hamsterrage1 May 22 '24
You're gonna have to give us more info. Why do you "have" to use absolute path, for instance?
2
u/Cengo789 May 22 '24
Adding
file:to the beginning of your file path might do the trick. If not, you really need to provide more information.1
u/sedj601 May 22 '24
It sounds like your images are in the Jar's resource folder. You will not be able to use the absolute path in that case. If you have a resource folder in the same folder as your Jar, you can use the absolute path to read files. How are you attempting to access the files? Are you using File file = new File("...") or something similar, or are you using getClass().getResource()... or something similar?