Java FX CSS @import path issue


In Java8_31 I imported different CSS files like that in my main.css:

@import "style/common/test1.css";
@import "style/common/test2.css";

All files were in the package style/common and it worked great.

Now with the build Java8_40 I did the same thing, but I get the following error message:

Could not find stylesheet:
com.sun.javafx.css.parser.CSSParser handleImport

All my styles from the CSS file test1.css are working. What I was curious about was the fact that my path style/common is showing up two times.

So I tried to change my imports to the following:

@import "style/common/test1.css";
@import "test2.css";

With these imports, both styles of the file test1 and the file test2 are working. But both files are still in the same package.

Whats happening here? Is there a known issue about the @import and probably a problem in the CSSParser?


It actually is a known issue:

There is a temporary fix available and the issue should be fixed in the next build Java8_u60.

The temporary fix can be made in the CSSParser class. Link to the git diff:

If you dont want to try the fix or wait for u60, just add all css files to the same folder and import it like that (temporary solution!):

@import "css/test1.css";
@import "test2.css";
@import "test3.css";
@import "testX.css";

Answered By – NDY

Answer Checked By – Mildred Charles (AngularFixing Admin)

Leave a Reply

Your email address will not be published.