I have a gradle project in eclipse. Here is the structure of my project
I have css resource styleclass.css
in scr/main/resources/css
. First I tried to access it using
scene.getStylesheets().add("css/styleclass.css");
But I was getting warning resource not found.
I also tried it by removing module-info.java
file. But result is same.
Then I tried it using
String urlString = ComboBoxStyling.class.getClassLoader().getResource("css/styleclass.css").toExternalForm();
Problem is, this line works if I remove moduele-info.java
and style sheet applied. But with module-info.java
I am getting null pointer exception.
I don't know much but atleast I know that class loader have changes in Java 9. So how can I do the same in Java 9. My module-info.java
file contains the following
module pk.training.basit {
exports pk.training.basit;
requires transitive javafx.controls;
}
Thanks & Regards
Basit Mahmood Ahmed
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…