css - JavaFX - Cannot load image from within project -


my javafx project can load image in 1 machine, same code cannot load image in machine.

i have package structure (in src) - /com/mypackagestructure/view/images/ , holds image file.

i have css file @ - /com/mypackagestructure/view/login.css

login.css .root {      -fx-background-image: url("/com/mypackagestructure/view/images/background.jpg");      -fx-background-repeat: stretch;      -fx-background-size: 100%;      -fx-background-color: transparent; } 

i have exact same code in machine (same os, same eclipse ide , jdk/jre (1.8) installed) , works on there. in machine following message-

aug 08, 2016 3:36:39 pm com.sun.javafx.css.stylemanager getcachedimage warning: error loading image: file:/com/mypackagestructure/view/images/background.jpg 

in css if make following change, works.

-fx-background-image: url("images/background.jpg"); 

what wrong way of referencing image file? , why work on 1 machine , not in other?

i have experienced same problem had. these happen because of build files , can try tou clean , build it.

basically if define -fx-background-image: url("images/background.jpg"); direcly refer project package location of images.

if want define previous way, have write down complete directory example c:\users\nilam\documents\netbeansprojects\aplikasi arsip kesbangpol\src\gambar\image.jpg

hopefully answer question.


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -