I work in NetBeans 8 with Java 8 / JavaFX and FXML.
In the first controller (AnchorPane) in my FXML document, I have this that works:
stylesheets="file:///C:/Users/me/Documents/NetBeansProjects/MyApp/src/myApp/myStyle.css"
However, when I try to replace this with any type of relative path, at runtime I get the following error:
com.sun.javafx.css.StyleManager loadStylesheetUnPrivileged
WARNING: Resource "myStyle.css" not found.
I tried
stylesheets="myStyle.css"
stylesheets="file://myStyle.css"
stylesheets="./myStyle.css"
stylesheets="css/myStyle.css"
(where I put a copy of the css file in the subdirectory where it was)
... and maybe 50 other permutations. Every time I get the same error.
I take care that I have a second problem. In the first version, which works on my machine ... when I take the jar file to another machine, css is not applied when the application is running ... It looks like a resource file that is not being copied.
reference
Thank!
-Adeena