I have a Java/JavaFX project where I use style sheets.
Images from stylesheets will get loaded as follows:
#pane {
-fx-background-image:url('../packagename/image.jpg');
}
It loads fine when I compile and run it from Eclipse or Scenebuilder. However, when running my jar file from the cmd (java -jar project.jar), it adds the file name to the path, changing it to:
project.jar/packagename/image.jpg
and obviously failing to load it. How do I get the correct path, or alternatively, omit the jar from the somehow jar generated path? The jar file is in the package folder here outlined as packagename.
jar tf project.jar)? Do the urls meet the requirements specified in the css reference ( docs.oracle.com/javase/8/javafx/api/javafx/scene/doc-files/… )?