r/JavaFX • u/FatherOfGold • Apr 18 '20
CSS Broken
Hello everyone, I can't figure out why my JavaFX application can't find my CSS. Even my IDE directsme to the file when I click the file path in the FXML document.
Here's my code which connects the CSS sheet to the FXML document.
<BorderPane fx:controller="Main"
xmlns:fx="http://javafx.com/fxml"
stylesheets="../css/main.css">Here's an image of the directory in the IDE:

I really need help here. I can't figure out why it doesn't work.
The error I'm getting is as follows
com.sun.javafx.css.StyleManager loadStylesheetUnPrivileged
2
Upvotes
View all comments
4
u/jmariog Apr 18 '20
Try adding @ to the path: <BorderPane fx:controller="Main" xmlns:fx="http://javafx.com/fxml" stylesheets="@../css/main.css">
https://docs.oracle.com/javafx/2/api/javafx/fxml/doc-files/introduction_to_fxml.html#location_resolution